Hi, is it possible via one callback to return both options
and value
?
My idea backfired on me.
@app.callback(
Output('phrase_dd_menu','children'),
[Input('type_dd_menu','value')])
def retrun_phrase_dd(type_value):
phrases = df3['QUERY_RAW_PHRASE'].unique()
return {
options=[{'label':uniq_phrase, 'value':uniq_phrase} for uniq_phrase in phrases],
value=phrase[0]
}
Edit:
I figured this out, return should be looking like this
return dict(
options=[{'label':uniq_phrase, 'value':uniq_phrase} for uniq_phrase in phrases],
value=phrases[0]
)
Unfortunately dcc. Dropdown do not support children property.
Done:
I have figured this out. Sorry for spamming but I want to document this (maybe it will be useful to somebody)
Multi output was answer here. Also that trailing comma after options was issue.
@app.callback([
Output('phrase_dd_menu','options'),
Output('phrase_dd_menu','value')],
[Input('type_dd_menu','value')])
def retrun_phrase_dd(type_value):
phrases = df3['QUERY_RAW_PHRASE'].unique()
options=[{'label':uniq_phrase, 'value':uniq_phrase} for uniq_phrase in phrases]
value=phrases[0]
return options, value