Not sure what is going on here. I try to update a dropdown menu and keep the value unchanged.
As soon as I include Output('pko-dropdown', 'value')
in the outputs the app stops working.
@app.callback(
Output('pko-dropdown', 'options'),
#Output('pko-dropdown', 'value'),
Input('tab', 'value'),
Input('pko-delete-output', 'children'),
State('wdir', 'children'),
State('pko-dropdown', 'options'),
State('pko-dropdown', 'value')
)
#def pko_controls(tab, peak_deleted, wdir, old_options):
def pko_controls(tab, peak_deleted, wdir, old_options, old_value):
if tab != 'pko':
raise PreventUpdate
peaklist = T.get_peaklist( wdir )
if peaklist is None:
raise PreventUpdate
options = [{'label':label, 'value': i} for i, label in enumerate(peaklist.index)]
if options == old_options:
raise PreventUpdate
value = 2 #old_value if old_value is not None else 0
return options #, 0
What is wrong? Do I have to store and update the value in a separate callback?