cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kea
Level: Powered On

Patch reverts to first item in Gallery

Hi all,

 

I have got this strange behaviour. I have 2 Sharepoint lists and want to update both lists when a button is clicked. The first time it works as expected, but then the Gallery reverts to the first item, not the selecte one. I want the gallery to stay on the selected item. As I said: when I patch the second sharepoint list, my gallery reverts to the first item in the gallery. If I remove the second patch it stays on the correct selected item. 

 

What am I doing wrong?

 

Capture.PNG

I hope someone can help me out. Listened all videos from @ShaneYoung, who saved me a lot of times. But this one is really interesting. 

 

Regards, Kea

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Patch reverts to first item in Gallery

This is normal behaviour. The data source is changing so the gallery is refreshing changing the selected item to the first in the gallery not the one you previously selected. 

 

What I do in this case is set the OnSelect in the gallery to store the item. Set(varRecord, ThisItem) then I use varRecord in place of Gallery.Selected. That way nothing changes. Smiley Happy 

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training
3 REPLIES 3
sopatte
Level 8

Re: Patch reverts to first item in Gallery

I'm having a hard time understanding your scenario and the issue. I'm not sure what it is you're seeing when you say "the Gallery reverts to the first item, not the selected one". Is the selection changing? Are the contents of the gallery changing? What is in your gallery (Items property)? Maybe boil this down to a simpler case that illustrates the problem clearly.

Highlighted
Super User
Super User

Re: Patch reverts to first item in Gallery

This is normal behaviour. The data source is changing so the gallery is refreshing changing the selected item to the first in the gallery not the one you previously selected. 

 

What I do in this case is set the OnSelect in the gallery to store the item. Set(varRecord, ThisItem) then I use varRecord in place of Gallery.Selected. That way nothing changes. Smiley Happy 

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training
Kea
Level: Powered On

Re: Patch reverts to first item in Gallery

 Thanks Shane!!! Keep up the good work.