web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : xEugsmTu5IeF3Bo4iMspUe
Power Apps - Building Power Apps
Unanswered

Waiting for a Gallery reset to finish?

Like (0) ShareShare
ReportReport
Posted on 15 Feb 2020 16:11:15 by 386

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.

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    149,252 Most Valuable Professional on 27 May 2022 at 12:28:56
    Re: Waiting for a Gallery reset to finish?

    @MichelH ,

    Please see post now

  • MichelH Profile Picture
    400 on 27 May 2022 at 11:43:31
    Re: Waiting for a Gallery reset to finish?

    @WarrenBelz 

    Sometimes I just can't read, maybe because @asifkhawaja  said 'count of the gallery'.  Somehow I saw that as:

     

     CountRows(GalleryName.AllItems) = 0

     

    instead of:

    GalleryName.AllItems = 0

    And now I'm completely puzzled.
    I would expect GalleryName.AllItems to return a table, since it is a collection, not a integer number.

    I will try this ASAP.

  • WarrenBelz Profile Picture
    149,252 Most Valuable Professional on 27 May 2022 at 07:34:05
    Re: Waiting for a Gallery reset to finish?

    @MichelH ,

    Mine refers to (and works very well) when a gallery needs to initially resolve its Items directly from a data source on screen opening and has multiple Filters. You are correct if you are updating a collection that this will not work.

  • MichelH Profile Picture
    400 on 27 May 2022 at 06:58:25
    Re: Waiting for a Gallery reset to finish?

    I doubt this will work as expected if you are updating the collection behind a gallery, which I believe EdHansberry is doing. You might as well launch the timer when you start updating. Problem is you don't know how long it will take.

    Given that we no longer can rely on a sequential execution of the gallery update, I think I need to adapt my previous suggestion, by testing if the minimum TS on the gallery equals the last timestamp.

    So I have a Toggle with this as the Toggle.Default:

    Min(Gallery.AllItems, TScolumn) = TS

    And the code I need, under the Toggle.OnCheck 

    Br,

    Michel

  • WarrenBelz Profile Picture
    149,252 Most Valuable Professional on 27 May 2022 at 03:13:01
    Re: Waiting for a Gallery reset to finish?

    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

     

  • asifkhawaja Profile Picture
    41 on 27 May 2022 at 02:23:30
    Re: Waiting for a Gallery reset to finish?

    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.

  • MichelH Profile Picture
    400 on 29 Jan 2022 at 15:43:13
    Re: Waiting for a Gallery reset to finish?

    @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

  • EdHansberry Profile Picture
    386 on 23 Feb 2020 at 14:37:14
    Re: Waiting for a Gallery reset to finish?

    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.

  • WarrenBelz Profile Picture
    149,252 Most Valuable Professional on 20 Feb 2020 at 04:58:55
    Re: Waiting for a Gallery reset to finish?

    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.

  • EdHansberry Profile Picture
    386 on 19 Feb 2020 at 20:36:31
    Re: Waiting for a Gallery reset to finish?

    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!