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!
Solved! Go to Solution.
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.
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,
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.
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,
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!
Thank you I had the same problem and this thread resolved it.
https://powerusers.microsoft.com/t5/Building-Power-Apps/Gallery-filter-selections-reset-when-navigat...
User | Count |
---|---|
183 | |
110 | |
88 | |
44 | |
42 |
User | Count |
---|---|
227 | |
108 | |
104 | |
68 | |
68 |