Solved

What is the proper way to refresh a grid in an action?

  • 28 October 2022
  • 4 replies
  • 92 views

Long story short: I’ve created a graph extension of the CustomerMaint graph. The extension adds a button to the attributes tab that instantiates a custom graph which changes the value of one of the attributes. Upon completion, I want the attributes grid to refresh and show the updated value, however I’ve tried…

Base.Answers.View.RequestRefresh();

and 

Base.Answers.View.Clear();

Base.Answers.View.RequestRefresh();

… but the grid will not refresh.

The logic successfully changes the value and clicking the refresh button on the grid shows me exactly what I want, but I don’t know how to call that Refresh in the code or trigger it in the ASPX. 

Any Ideas?

icon

Best answer by Fernando Amadoz 28 October 2022, 19:45

View original

4 replies

Userlevel 7
Badge +14

Hi @martinxfe  It should show updated values as soon as the button process is completed and I don’t think extra code is required to refresh the grid.

Is it possible to share the code, so that I can check from my end and let you know if anything to be fix.

Userlevel 5
Badge

@martinxfe you may want to try to encapsulate the button’s logic within a PXLongOperation.

        public PXAction<DACName> ActionName;
[PXButton(CommitChanges = true)]
[PXUIField(DisplayName = "Action name")]
protected virtual void actionName()
{
PXLongOperation.StartOperation(this.Base,
delegate ()
{
//Your logic goes here: instantiate graph...
});
}

 

Userlevel 5
Badge +2

assuming all changes are saved during the action I find that Base.Cancel.Press() works well for me.

Unfortunately you can’t run that from within a PXLongOperation as it will cancel the operation.

 So if what you are doing is not a long process perhaps its an option to just run within the action code at the end?

Naveen and Fernando, 

I believe you were both after the same thing. After encapsulating in the long op, the graph updated automatically and works great. Thanks! 

 

Shawn, 

I’d not had the time to figure out what I was getting wrong with the long op originally, and cancelling the graph was a good work around in the mean time, so thank you also for the input. 

 

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2022  Acumatica, Inc. All rights reserved