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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to stop a Gallery ...
Power Apps
Unanswered

How to stop a Gallery resetting when datasource refreshes?

(0) ShareShare
ReportReport
Posted on by 37

Afternoon

 

I have an app that I'm working on that loads in rows of data from an SQL DB - let's say 100-200 rows. I have a timer set to refresh the data regularly so that it's as up-to-date as possible for the app admins to review. The users scroll down the list, checking details, and occasionally making an adjustment. However, if they are just scrolling down the list and reviewing rows, they get maybe to row 75, before the refresh....at which point the data refreshes and the gallery resets - so they are no longer at row 75...it's not usually the top of the gallery, but somewhere between row 1 and 75.

 

What I'd like is to be able to refresh the data regularly, but the gallery stays at the point its currently sitting at when the refresh takes place.

 

Is this possible? Anyone any ideas how to freeze the gallery in place?

 

 

Thanks,

Chris

Categories:
  • Gerard Simpson Profile Picture
    2,987 Moderator on at

    Hi @chris421 

     

    Try adding this to the default property of your gallery:

     

    {}

     

    Hope this helps

    Gerard

  • chris421 Profile Picture
    37 on at

    Hi @AmDev

     

    Unfortunately, that doesn't seem to have changed anything...it's still moving the gallery current position; although I'm noticing its only if i'm further down than the item it seems to reset to.

    For example; if it's resetting to item 100 (I'm not sure which item it is exactly compared to the full gallery of data)....if I'm reviewing around 50/60 etc, then it stays where it is.....but if i'm review rows further down than 100, then it resets back.

     

    Chris

  • chris421 Profile Picture
    37 on at

    Little update....I did a bit more testing, and have managed to ascertain that it's resetting to row 100 (so that row 100 is the last row visible in the gallery) - that's why when I'm above this row, nothing happens, but when I'm further down the gallery, it moves.

     

    The issue is going to be that, once in use, there could be around 500 rows of data in the table to be reviewed before processing. I don't really want a user getting to row 400 and then the view resetting to 100, and them having to almost start again.

    I can't really extend the timer too much, as I don't know how long it would take to review the data.

    I suppose I could make the refresh manual (as a workaround), but I really don't like the idea that the reviewing user could be viewing out of date data...automated refresh is far preferred.

  • WarrenBelz Profile Picture
    156,926 Most Valuable Professional on at

    Hi @chris421 ,

    One option which may suit you (although it has another effect)  and you need a unique identifier for this - OnSelect of the gallery (the user has to select the record for this to work)

    UpdateContext({varID: ThisItem.YourIdentifier})

    then the Default of the Gallery

    LookUp(
     YourTableName,
     YourIdentifierName = varID
    )

    The effect I refer to is that immediately on the selection, the item chosen will move to the top of the gallery, however it will also stay there when the gallery is refreshed.

     

    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.

    Visit my blog Practical Power Apps

     

  • chris421 Profile Picture
    37 on at

    Hi @WarrenBelz 

     

    Thanks for the suggestion. I've given this a shot and, when an item is selected, it's going straight to the top of the gallery as anticipated - which is something I could have worked round. However, on refresh, the gallery is still resetting to the point where item 100 is at the bottom of the gallery; so, it seems to be ignoring the fact the it's default is set to a specific item if the selected item is over 100.

     

    It would've been ideal to have the gallery stay still during a refresh (and could be quite handy for other apps using larger datasets). However, for this app, I've since spoken to the users that will be using the app, and I think i'm going to manage to do the "admin review" gallery without the need for an auto refresh after all - the data feeding this gallery won't be getting updated live by the time they actually review it (it'll be admin updates only)....so this should mean that I only need to account for the records they update, rather than the full gallery/data source refreshing.

     

     

    Chris

  • WarrenBelz Profile Picture
    156,926 Most Valuable Professional on at

    Hi @chris421 ,

    That sounds like a better idea - my suggestion was a bit of a workaround anyway

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 236 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 130

Last 30 days Overall leaderboard