Say we have to filter on a tree-like data source, i.e.
Province. Each of the three categories has its own dropdown menu with some
At first run, the States and Provinces lists are empty. When a
Country is chosen,
States are populated, and when a
State is chosen, Provinces are populated.
Now that a
Province has been chosen, when the user selects another
Country, Provinces and States should be reset to an initial state, with the
How can this be done? A callback signature for the Countries list that clears the Provinces list would look like:
@callback(Output('provinces-list', 'options'), [Input('countries-list', 'n_clicks')]) def clear_provinces_list(): [... clear the provinces-list component here]
But a callback signature for selecting from the States list would be
@callback(Output('provinces-list', 'options'), [Input('states-list', 'n_clicks')]) def populate_provinces_list(): [... populate the provinces-list component here]
This results in a message
You have already assigned a callback to the output
with ID “provinces-list” and property “options”. An output can only have
a single callback function. Try combining your inputs and
callback functions together into one function.
This may have been addressed before, but I don’t understand what it means to “combine inputs and callbacks” into a single function…