Notifications
Announcements
Is there a way on a vertical gallery that, when you select a gallery item, have it snap to the top?
Hi @Brian-M,
With a Vertical Gallery (with a scrollbar) you can achieve this with the following code:
//OnSelect of the Gallery UpdateContext({varSelectedRecord: ThisItem}); //Change GalleryName to the correct name Reset(GalleryName)
//Default of the Gallery varSelectedRecord
If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.
Thanks!
Ok, that works perfectly (Thank you!) with one caveat. I'm trying to convert a gallery into a drop-down list to bypass the 2K record limit on comboboxes. Everything works perfectly until; after a user selects a name, the name snaps to the top, and then the gallery height adjusts to display just the top record. That's when the 'snap to top' doesn't work - when the gallery height adjusts. See attached videos. Any suggestions on how to fix that?
Here are two Gifs
Big thanks for the Gifs. I did some tests on my end and the functionality worked as expected (also when resizing the gallery):
//OnSelect of the Gallery UpdateContext({varSelectedRecord: ThisItem}); //Change gallery Height UpdateContext({varGalHeight: 50}); //Change GalleryName to the correct name Reset(GalleryName)
The Gallery Height would be varGalHeight (the arrow icon would e.g. set this to 500) and the Default would still remain varSelectedRecord.
Do note that the Gallery is also limited to a max. of 2000 records (depending on your Data Row Limit). 2000 rows is the general limit of data fetching for Canvas Apps.
I hope this helps!
In my test UpdateContext doesn't recognize/find varGalHeight, so I had used Set instead.
One thing that comes to mind is: Make sure that you have Select(Parent) in the OnSelect of your label (within the gallery). Otherwise the code in the OnSelect of the Gallery will not run.
Thanks for your help on this!
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.
In our never-ending quest to improve we are simplifying the forum hierarchy…
We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
WarrenBelz 717 Most Valuable Professional
Michael E. Gernaey 329 Super User 2025 Season 2
Power Platform 1919 268