Hi,
I have some dropdowns that return the options in callbacks, for example:
@app.callback(
dash.dependencies.Output('types-dropdown', 'options'),
[dash.dependencies.Input('data-json', 'options')])
def update_types_menu(data):
col_name = data['name']
return [{'label': i, 'value': i} for i in col_name]
The problem is, when the data-json
is updated and the chosen value in the dropdown also exists in the new data-json
, it will be chosen. But I want no value is chosen when it is updated.
- Cannot use default value on callback, like in Reset to Initial state without reloading page, because of flexibility of the input.
- Set attribute
value
indcc.Dropdown
doesn’t work on updated data.
Are there any ways to return a NULL chosen value for dropdown callback, like:
...
return ( [{'label': i, 'value': i} for i in col_name]
chosen_value="")
or somehow set the default value
for dcc.Dropdown
even in newly updated inputs ?
Thank you in advance.