Skip to main content
Solved

Toolbar button not showing up


Forum|alt.badge.img+8
  • Captain II
  • 384 replies

Hello everyone, 

 

I have a custom screen with a few tabs, at least one grid on each tab.

I am trying to add a action to the toolbar of one of the grids, ‘Design, Material & Cost’,  when I have my PXAction like below, which is the grid’s DAC, it appears but does nothing when run:

 public PXAction<NPDDesignMatlCost> CreateInventoryItem;
 [PXButton]
 [PXUIField(DisplayName = "Create Inventory")]
 public virtual IEnumerable createInventoryItem(PXAdapter adapter)
 {
     PXTrace.WriteInformation("Action ran");
     return adapter.Get();
 }

When I have PXAction as the main screen DAC, it does not appear at all.

 

My .aspx is here:

<px:PXGrid runat="server" ID="CstPXGrid32" Caption="Design, Material, Cost" CaptionVisible="True" Height="250px" SkinID="DetailsInTab" Width="100%">
				<Levels>
					<px:PXGridLevel DataMember="DesignMatlCost" >
						<Columns>
							<px:PXGridColumn Type="CheckBox" DataField="Selected" Width="60" ></px:PXGridColumn>
							<px:PXGridColumn DataField="MatlLineNbr" Width="100px" ></px:PXGridColumn>
							<px:PXGridColumn DataField="InventoryID" Width="100px" ></px:PXGridColumn>
							<px:PXGridColumn DataField="NonInventoryID" Width="100px" ></px:PXGridColumn>
							<px:PXGridColumn DataField="Uom" Width="100px" ></px:PXGridColumn>
							<px:PXGridColumn DataField="Quantity" Width="100px" ></px:PXGridColumn>
							<px:PXGridColumn DataField="UnitCost" Width="100px" ></px:PXGridColumn>
							<px:PXGridColumn DataField="ExtCost" Width="100px" ></px:PXGridColumn>
							<px:PXGridColumn DataField="CreatedByID_Creator_displayName" Width="100px" ></px:PXGridColumn>
							<px:PXGridColumn DataField="LastModifiedByID_Modifier_displayName" Width="100px" ></px:PXGridColumn></Columns></px:PXGridLevel></Levels>
				<ActionBar>
					<CustomItems>
						<px:PXToolBarButton Text="Create Inventory" CommandName="CreateInventoryItem" CommandSourceID="ds" DependOnGrid="CstPXGrid32">
						</px:PXToolBarButton>
					</CustomItems>
				</ActionBar>
				<Mode InitNewRow="True" ></Mode></px:PXGrid>

 

Best answer by Django

In my notes, I have a reference to this SO question:

https://stackoverflow.com/questions/68996115/add-buttons-to-grid-in-acumatica

I feel like these instructions are not quite correct but I’ve used these steps to get the buttons to work.

Here is the selected answer for that post:

To add your actions to the grid you perform the following steps:

1. Open your customization package
2. Add your screen [AP303000]
3. Open the added screen
4. Get the ID of the grid that you want to add the button above. You'll need that later.
5. Find your action (DataSource --> Toolbar --> Form-Specific --> Approve Payment Method)
   (It could be under Toolbar --> Form-Specific --> Other)
6. Set the following Properties:

- DependsOnGrid: grdPaymentDetails (this is the id of the grid control you are adding it to)
- Visible: False (this hides it from the top of the screen)

7. Save
8. Find the grid you want to add the action to (Tab --> Payment --> Form --> [2nd] Column --> Group --> Grid: PaymentDetails)
9. Add Control to Grid (Add Controls --> Click and Drag BUTTON onto Grid:PaymentDetails)
10. Select new button ([Grid: PaymentDetails] --> ActionBar-CustomItems --> ToolBarButton
11. Set the following Properties

- AutoCallBack --> Command: ApprovePaymentMethod (this is the action name in code)
- AutoCallBack --> Target: ds (this is the datasource for the action)
- Text: Approve Payment Method (This is the text shown on the button)

12. Save

At this point you would normally be able to repeat steps 4-11 for RejectPaymentMethod then publish and see the actions moved into the grid. For this particular situation there is a catch. The grid you want to add them to has the SkinID of Attributes which doesn't support the action toolbar. You need to override this property with the following steps:

12. Select the target grid (Tab --> Payment --> Form --> [2nd] Column --> Group --> Grid: PaymentDetails)
13. Update the following Property:

- SkinID: Details

14. Save

Now you can publish and see the action shown as desired. Note details will show the standard button set, so you'll likely want to remove those with the following steps

15. Select the target grid (Tab --> Payment --> Form --> [2nd] Column --> Group --> Grid: PaymentDetails)
16. Set the following Properties:

- ActionBar --> Actions --> AddNew --> ToolBarVisible: false
- ActionBar --> Actions --> AdjustColumn --> ToolBarVisible: false
- ActionBar --> Actions --> Delete --> ToolBarVisible: false
- ActionBar --> Actions --> ExportExcel --> ToolBarVisible: false
- ActionBar --> Actions --> Refresh --> ToolBarVisible: false

At this point when you publish your actions will be on the grid (this is assuming you've repeated steps 4-11 for RejectPaymentMethod.)

 

View original
Did this topic help you find an answer to your question?

4 replies

Forum|alt.badge.img+6
  • Captain II
  • 572 replies
  • Answer
  • April 10, 2025

In my notes, I have a reference to this SO question:

https://stackoverflow.com/questions/68996115/add-buttons-to-grid-in-acumatica

I feel like these instructions are not quite correct but I’ve used these steps to get the buttons to work.

Here is the selected answer for that post:

To add your actions to the grid you perform the following steps:

1. Open your customization package
2. Add your screen [AP303000]
3. Open the added screen
4. Get the ID of the grid that you want to add the button above. You'll need that later.
5. Find your action (DataSource --> Toolbar --> Form-Specific --> Approve Payment Method)
   (It could be under Toolbar --> Form-Specific --> Other)
6. Set the following Properties:

- DependsOnGrid: grdPaymentDetails (this is the id of the grid control you are adding it to)
- Visible: False (this hides it from the top of the screen)

7. Save
8. Find the grid you want to add the action to (Tab --> Payment --> Form --> [2nd] Column --> Group --> Grid: PaymentDetails)
9. Add Control to Grid (Add Controls --> Click and Drag BUTTON onto Grid:PaymentDetails)
10. Select new button ([Grid: PaymentDetails] --> ActionBar-CustomItems --> ToolBarButton
11. Set the following Properties

- AutoCallBack --> Command: ApprovePaymentMethod (this is the action name in code)
- AutoCallBack --> Target: ds (this is the datasource for the action)
- Text: Approve Payment Method (This is the text shown on the button)

12. Save

At this point you would normally be able to repeat steps 4-11 for RejectPaymentMethod then publish and see the actions moved into the grid. For this particular situation there is a catch. The grid you want to add them to has the SkinID of Attributes which doesn't support the action toolbar. You need to override this property with the following steps:

12. Select the target grid (Tab --> Payment --> Form --> [2nd] Column --> Group --> Grid: PaymentDetails)
13. Update the following Property:

- SkinID: Details

14. Save

Now you can publish and see the action shown as desired. Note details will show the standard button set, so you'll likely want to remove those with the following steps

15. Select the target grid (Tab --> Payment --> Form --> [2nd] Column --> Group --> Grid: PaymentDetails)
16. Set the following Properties:

- ActionBar --> Actions --> AddNew --> ToolBarVisible: false
- ActionBar --> Actions --> AdjustColumn --> ToolBarVisible: false
- ActionBar --> Actions --> Delete --> ToolBarVisible: false
- ActionBar --> Actions --> ExportExcel --> ToolBarVisible: false
- ActionBar --> Actions --> Refresh --> ToolBarVisible: false

At this point when you publish your actions will be on the grid (this is assuming you've repeated steps 4-11 for RejectPaymentMethod.)

 


davidnavasardyan
Jr Varsity I
Forum|alt.badge.img+2

Hi @aiwan,

Please change your command name from CommandName="CreateInventoryItem" to CommandName="createInventoryItem".

When specifying the command name, you need to use the action function name exactly as it's defined.


Forum|alt.badge.img+8
  • Author
  • Captain II
  • 384 replies
  • April 11, 2025

Hi ​@davidnavasardyan 

 

I tried both ways but to no avail unfortunately.


Forum|alt.badge.img+8
  • Author
  • Captain II
  • 384 replies
  • April 11, 2025

Thanks ​@Django 

 

I will give that one a bash.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings