Skip to main content
Solved

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

  • October 28, 2022
  • 4 replies
  • 875 views

martinxfe
Jr Varsity II
Forum|alt.badge.img

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?

Best answer by Fernando Amadoz

@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...
                });
        }

 

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

4 replies

Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3416 replies
  • October 28, 2022

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.


Fernando Amadoz
Jr Varsity I
Forum|alt.badge.img+2

@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...
                });
        }

 


Shawn Burt
Jr Varsity I
Forum|alt.badge.img+1
  • Jr Varsity I
  • 109 replies
  • October 28, 2022

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?


martinxfe
Jr Varsity II
Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • 22 replies
  • January 16, 2023

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


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