cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

gallery list selection defaults to first screen on list

My Gallery list selection defaults to show the first screen on list, not the one selected, then when you click another item in the gallery list, it goes to the screen of your previous selection.

 

e.g. I select "Cleaning" and the next screen shown is the first one for "Good Better Best", then when I select another menu item, e.g. "Barware", it will show the last one chosen which was "Cleaning" If I select another menu item it will then show "Barware", etc etc.  Essentially you have to click on the Gallery list item twice to get to the screen you actually want to view.

 

menu.png

 

I am using ClearCollect on the Menu screen (above)

 

ClearCollect(Screens,{Name:"GBB",Target:GBB},{Name:"Bakery",Target:Bakery},{Name:"Barware",Target:Barware},{Name:"Cleaning",Target:Cleaning},{Name:"Coffee",Target:Coffee},{Name:"Cooking",Target:Cooking},{Name:"Crockery",Target:Crockery},{Name:"Cutlery",Target:Cutlery},{Name:"DisplayCabinets1",Target:DisplayCabinets1},{Name:"Displayware",Target:Displayware1},{Name:"Furniture",Target:Furniture},{Name:"Kitchenware",Target:Kitchenware1},{Name:"MealDistribution",Target:MealDist},{Name:"Refrigeration",Target:Refrigeration},{Name:"Stainless",Target:Stainless},{Name:"Storage",Target:Storage1},{Name:"Tabletop",Target:Tabletop1},{Name:"Uniforms",Target:Uniforms})

 

and for the OnSelect action: 

 

Navigate(LookUp(Screens,Name = Gallery1.Selected.ScreenRef,Target),None)

 

ScreenRef is referenced in my Sharepoint list and the Target is the name of the screen.

 

Any ideas on why it's doing this and how I can fix it?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Power Apps
Power Apps

Re: gallery list selection defaults to first screen on list

You can try using the ThisItem operator instead of the gallery selection to decide which screen to navigate to.

Navigate(LookUp(Screens,Name = ThisItem.ScreenRef,Target),None)

The issue is that when you click on the right arrow, two actions happen: the gallery selection is changed, and the OnSelect property of the arrow is executed. There is no guarantee which one will be executed first (and I've observed that it happens differently in multiple platforms), so what you're seeing is probably the OnSelect is being executed before the selection change. By using the ThisItem operator, you guarantee that you're choosing the item from the corresponding row in the gallery.

View solution in original post

5 REPLIES 5
Highlighted
Power Apps
Power Apps

Re: gallery list selection defaults to first screen on list

Hi,

 

You could add a switch statement to the OnSelect.

 

Something like this

 

Switch(
  Gallery1.Selected.ScreenRef,
  "GBB",Navigate(GBB, Fade),
  "Bakery",Navigate(Bakery, Fade)
)

 

Thanks

Cherie

 

Highlighted
Power Apps
Power Apps

Re: gallery list selection defaults to first screen on list

You can try using the ThisItem operator instead of the gallery selection to decide which screen to navigate to.

Navigate(LookUp(Screens,Name = ThisItem.ScreenRef,Target),None)

The issue is that when you click on the right arrow, two actions happen: the gallery selection is changed, and the OnSelect property of the arrow is executed. There is no guarantee which one will be executed first (and I've observed that it happens differently in multiple platforms), so what you're seeing is probably the OnSelect is being executed before the selection change. By using the ThisItem operator, you guarantee that you're choosing the item from the corresponding row in the gallery.

View solution in original post

Highlighted
Helper I
Helper I

Re: gallery list selection defaults to first screen on list

awesome, that worked!  Thank you, a nice simple answer and thanks for explaining the reason too.

Highlighted
Helper I
Helper I

Re: gallery list selection defaults to first screen on list

Thanks for the first idea, I did try this and it didn't work, but the next solution did work ok

Highlighted
Helper IV
Helper IV

Re: gallery list selection defaults to first screen on list

(Deleted comment)

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (5,813)