cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bouillons
Helper III
Helper III

How to select the first item in gallery after filtering the sharepoint list

I have a question, where I have a gallery that is (a filter of) a sharepoint list. When the Gallery's items result is changed after the filter is applied and there are results, I want to "OnSelect" the first result. I haven't found a consistent way to achieve this. It looks like the first item is selected but without triggering the commands in the OnSelect of the gallery ?

 

Kindest regards,

Stephane

3 REPLIES 3
rubin_boer
Super User
Super User

hi @bouillons im not entirely sure i understand your request but can offer this with an example.

 

assume you have a combobox that filter a gallery and that gallery filter another gallery. when you filter the fisrt gallery by selecting a new value, the values in the gallery change but they secon gallery still shows the previous selection's results. do get around this you can add to the combobox's OnChange = Reset(Gallery1) this way the gallery is empty and the second gallery is cleared. then when the first gallery is populated the second gallery is filter by the first record.

 

consider the selection

rubin_boer_0-1617894738756.png

Without resetting the gallery: (the filter applies the 5 to the first gallery but the second gallery still shows the results of the previous selection, visitor 2)

rubin_boer_1-1617894768140.png

With the reset of the gallery: (the second gallery goes back to visitor 1 which is the first row)

rubin_boer_2-1617894869751.png

hope this helps

 

 

 

bouillons
Helper III
Helper III

Thanks, I'll try this. I have a follow-up question: assuming the gallery is loaded already in memory, does the reset cause the data to be refetched from the data source ?

 

Stephane

bouillons
Helper III
Helper III

I still don't get the result I wanted. What I want is that whenever the content of the gallery changes, I want the OnSelect of the first item to be executed. So my question is how can I programmatically "click" the gallery's first item in the onchange event of the controls that influence the items selection of the gallery.

Stephane

 

Stephane

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (45,455)