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

Prevent Dropdown selection from changing when navigating away from screen

Hi all,

 

Hopefully this is a simple one though I have struggled to find a solution here that matches my scenario;

 

I have a gallery that is currently filtered by a dropdown control, and what I am hoping to do, is stop it from resetting when users move to a different screen and come back. So if they picked "Available" from the dropdown, the gallery only shows items with Available status. Then if they go to a different screen and come back, the dropdown is still showing the same selection of "Available" and therefore the gallery only displays items that have a status of Available.

 

Thanks in advance!

2 ACCEPTED SOLUTIONS

Accepted Solutions

Hi @BrendanZ1 ,

One option would be to put that code on the control that navigates to the screen (on the previous screen).

That way when you go back to it from somewhere else, the gallery will not reset.

 

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.

View solution in original post

Hi @BrendanZ1 ,

Based on the issue that you mentioned, I think your thought is right. If you put the ClearCollect formula within the OnVisible property of the screen, whenever you navigate back from another screen, the ClearCollect formula would be executed again, so your coljobstatus collection would be reset.

 

I agree with your thought, I think a global variable could achieve your needs. Please consider take a try with the following workaround:

Set the OnChange property of the Dropdown box to following:

Set(SelectedItem, Dropdown1.Selected.Value)

 

Set the Default property of the Dropdown box to following:

SelectedItem

 

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

8 REPLIES 8
Super User III
Super User III

Hi @BrendanZ1 ,

The gallery should not reset just by changing screens unless you have something (probably at Screen OnVisible) to do this.

Can you please check this.

 

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.

 

 

Hi @WarrenBelz ,

The screen has a ClearCollect and Collect function to establish the list for the Dropdown, so that causes the issue I guess as it resets the list. Dont' suppose there is a way around this? Could I use a variable somehow?

 

The OnVisible is:
ClearCollect(coljobstatus, {JobStatus: "All"});
Collect(coljobstatus, JobStatusList.JobStatus);

 

The Dropdown item property is: coljobstatus

Hi @BrendanZ1 ,

One option would be to put that code on the control that navigates to the screen (on the previous screen).

That way when you go back to it from somewhere else, the gallery will not reset.

 

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.

View solution in original post

Hi @BrendanZ1 ,

Based on the issue that you mentioned, I think your thought is right. If you put the ClearCollect formula within the OnVisible property of the screen, whenever you navigate back from another screen, the ClearCollect formula would be executed again, so your coljobstatus collection would be reset.

 

I agree with your thought, I think a global variable could achieve your needs. Please consider take a try with the following workaround:

Set the OnChange property of the Dropdown box to following:

Set(SelectedItem, Dropdown1.Selected.Value)

 

Set the Default property of the Dropdown box to following:

SelectedItem

 

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Thanks to both @WarrenBelz and @v-xida-msft for the solution. In the end I used both suggestions to complete this.

 

I moved my collection execution to the OnStart of the App and then added a variable to maintain the dropdown selection.

I initially tried the collections as running with the buttons that navigate to the screen but didn't seem to work. At the OnStart I had no worries.

 

Sorry I couldn't mark both of your suggestions as the solution.

Thanks @BrendanZ1 ,

You can accept more than one post as the solution if you choose.

Well then - that makes it easy. Done!

 

Thanks again for the help!

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

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

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (52,920)