I have a gallery where a Reset is triggered by a toggle button that will show/hide certain records. I want a "Processing" dialog to show up while the reset happens. I added this to the "OnChange" of the toggle, but it does nothing visually.
UpdateContext({varShowProcessing: true});
Reset(galItemSelection);
UpdateContext({varShowProcessing: false})
What I am pretty sure is happening is the variable is set to true, the reset is triggered, and immediately the variable is set back to false.
Is there a way to wait for the reset to finish?
I've added a timer, but that is a bad solution. Sometimes the reset takes a second or so, and other times 5+ seconds depending on the data, connection, etc, and it looks silly for the "Processing...." dialog to be there blocking the user when the data has obviously refreshed, and just as silly to have the dialog disappear and the refreshing is still happening.
I'm not on the right computer to test this, but this gallery doesn't do a loading spinner when the gallery is reset. It might or might not get the marching ants. It just seems to hang for a few seconds when the user flips the toggle, which actually changes the data called in the Items property. It is an IF statement. If tglShowArchivedItems is on, then it pulls all records. If off, then it add a FILTER() statement.
So the toggle isn't really refreshing the gallery so much as changing a context variable on that page which changes what the gallery is actually showing. Maybe that is why there is no spinner.
Also open to better ways of doing what I'm doing.
Hi @EdHansberry ,
@GarethPrisk is totally on the right track.
You can do a loading spinner on anything - it does not have to be on screen change.
Just put a full screen semi-transparent rectangle (RGBA 230, 230, 230, 0.5 is close) and group with the attached spinner.
Make them visible on vSpin (or whatever) and set/unset this at start/end of code.
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
I've made changes to the LoadingSpinner property and the related .Color property and nothing is happening. I don't think a refresh of the Gallery screen is trappable. Loading yes, but not just changing what is show by changing the FILTER() function in the Items property. 😐
I've looked through several threads in this forum and watched 2 youtube videos. Everything is about loading the gallery when the screen changes, not when the gallery is re-reading data. The marching ants are working across the top, but that is too hidden to the average user, and LoadingSpinner doesn't recognize that aspect that I can tell.
Hi @EdHansberry ,
You got me thinking on this and I have a bit of as sneaky workaround that I think does the job.
Do a new blank screen with the background RGBA( 230, 230, 230, 0.5) and put the spinner in the middle.
Navigate to this screen at the start of the code with Transition.Fade and then back again to your screen with the same transition.
Screen fades to spinner and then fades in again at code end.
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Unfortunately that doesn't really do it. I see what you are doing but that is an entirely different screen. Power Apps clearly knows when data is being refreshed because the marching ants go across the top, but there is, AFAIK, no way to have a more visible spinner or even a dialog box blocking interaction until the gallery refreshes.
@EdHansberry
Hi Ed,
I'm facing a similar situation where I need to recalculate some variables using data from the gallery, and this must be done when the gallery has finished loading or finished updating. So like you I'm looking for an event that says just this.
Did you find a solution for this?
I was thinking to use an Now() seconds+msec timestamp TS, and to add a column that holds this timestamp and test if the Last( Gallery.AllItems entry for that column, has the value that matches the timestamp, but I still hope a more elegant solution is possible.
When I put this in the Default property of a toggle control: Last(Gallery.AllItems).TS = TS
Power Apps insists I'm creating a circular reference.
Moving the toggle control to the screen, instead of a form and the "circular reference" is gone.
Best Regards,
Michel
You can do this using a Timer control. Set timer to 1 second (or half a second etc). Then every 1 second (or half a second) check if the count of the gallery is not 0. If it is 0, continue; if it is not, stop the timer. And on the timer end event, perform whatever actions you need to, including refreshing any variables.
Hope that gives some ideas.
I actually found one that works quite well - similar to @asifkhawaja , but without the timer. I have a spinner with the Visible
CountRows(GalleryName.AllItems) = 0
It is visible while the gallery is loading and disappears as soon as it fills
User | Count |
---|---|
260 | |
109 | |
93 | |
57 | |
41 |