Add button to grid in Acumatica

Hello everybody,

today I want briefly share how to add button to Grid in Acumatica. Actually button without any dialogs. Just button with posibility to run C# code.

Lets say you have grid, and want name for button Calculate. 

Then in graph you should write something like this:

public PXAction<PRPayroll> Calculate;
[PXButton]
[PXUIField(DisplayName = "Calculate")]
public virtual IEnumerable calculate(PXAdapter adapter)
{
   return adapter.Get();
}

And in grid something like this:

 <ActionBar ActionsText="True">
    <CustomItems>
        <px:PXToolBarButton>
        <AutoCallBack Command="Calculate" Target="ds" >
             </AutoCallBack>
       </px:PXToolBarButton>
     </CustomItems>
 </ActionBar>
</px:PXGrid>

And you'll get in your grid nice button Calculate. Enjoy

Comments (5) -

  • I have to add a button on the screen and when I click it the Grid rows should be refreshed and new values should be saved in Database? Can you help me how to do that?
  • yes! At which screen you need to add button?
  • and at which grid?
  • how about making a button on the form or Header
  • Just add this part in graph or graph extension:

    public PXAction<PRPayroll> Calculate;
    [PXButton]
    [PXUIField(DisplayName = "Calculate")]
    public virtual IEnumerable calculate(PXAdapter adapter)
    {
       return adapter.Get();
    }

Add comment

Loading