web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Reset Drop Down when l...
Power Apps
Answered

Reset Drop Down when leaving screen

(0) ShareShare
ReportReport
Posted on by 1,146

Thank you for taking the time to read my question.

I have this code that resets my drop down.

 

UpdateContext({resettext: !resettext});
UpdateContext({resettext: !resettext});

 

It currently runs when the screen becomes visible (OnVisible). The drop down filters a gallery. 

 

I want to reset my drop down because it remembers what I selected last time I was on that screen and filters for that value. Having the code run at OnVisible flashes the gallery for a second before the drop down is reset. I don't want this...

 

I have a back button and I put my code on that button before the Back() function is called. That does not seem to reset the drop down. 

 

How can I reset my drop down before the user navigates to the screen so they do not see a flash of what was selected last time before resetting?

 

Thanks

Categories:
  • Pstork1 Profile Picture
    69,665 Most Valuable Professional on at

    Instead of resetting the value using a context variable simply call on the button.

    reset(dropdowncontrolname);

     

  • iwonder Profile Picture
    1,146 on at

    Hi @Pstork1 

     

    Thank you for your quick reply.

     

    Here is what I have now:

    Reset(ddFilterPlant);
    Navigate(CustomerScreen,Fade)
    //Back(ScreenTransition.Fade);

     

    checking to see if Navigate acts any differently....

     

    When I go back to the CustomerScreen, then navigate back to the FilterScreen (where the drop down is) the previously selected value in ddFilterPlant is still remembered.

     

     

  • Pstork1 Profile Picture
    69,665 Most Valuable Professional on at

    What is the default setting for ddFilterPlant?  Doing a Reset should set the dropdown back to the original default value.  Do you still have the code in the OnVisible?  Taht may be overriding the default when you navigate back to the screen.

  • iwonder Profile Picture
    1,146 on at

    I did not have a default value for my drop down. I've set it to

    "*SELECT"

     

    Tried again and it still remembers the value I selected before leaving the screen.


    The Items for my drop down come from a collection:

    Sort(colPlants,Result)

    I make the collection by ClearCollect a distinct list from a SharePoint list and then I Collect "*SELECT" to the collection

     

    any other thoughts?

  • iwonder Profile Picture
    1,146 on at

    Did more testing... it seems it always selects the second value in the list unless I use my original code in the OnView of the screen. So even if I select the 4th value in the list, when I come back it sets it to the second value in the list.

     

    Not sure if that helps.

  • iwonder Profile Picture
    1,146 on at

    I added a temporary button to my screen and the Reset() works as expected. I just does not seem to work if I place it on my icon which is used to navigate back to the CustomerScreen.

     

    Also, if I set my drop down to *Select, I do not get that value when I return to the page.

     

    It must not have anything to do with the Reset() function but perhaps a setting on my drop down?

  • iwonder Profile Picture
    1,146 on at

    Sorry for all the posts....

     

    Originally if I entered the app for the first time the drop down would default to the first value... now that I've been playing with my app, it no longer does that. I deleted the drop down and added a new one... it still does not select the first value in the list

  • Verified answer
    iwonder Profile Picture
    1,146 on at

    I believe I have it.

     

    The Items() of my drop down is now:

     

    Distinct(Sort(colPlants,Result),Result)

     

    and I use Reset() before leaving the screen.

     

    Thanks!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 243 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 190 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard