✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🧬 Learn how to build RNA-Seq data apps with Python & Dash. Register for the May 20 Webinar!

Updating a dropdown if user clicks on it

Question: Is there a way to update a drop down only if the user clicks on it? (I didn’t see a n_clicks property for the drop down like the html components have).

Example: Say you have a “city” drop down and a “zipcode” drop down (among several other drop downs) whose options are based on a large healthcare database, and both are multi-select and optional for the user. You’d like the zipcode drop down to be based on the selected values in city if needed.

Challenge: Now you could update the zipcode options every time the city selected values change. But is there a way to only update the zipcode options when/if it’s needed (such as when the user selects it) else leave the zipcode options blank and eliminate unnecessary querying of the database (and possibly wait time in the app)… Any ideas?

@chriddyp @nedned et al