I have created 2 dropdowns. both of them fires on single button. 4 days back this layout was working great.
But since few days back only one callback is firing and not other one.
I tried to look into the callback which was not firing. It turns out the callback firing but it is not returning anything.
I tried to print everything till return of the same callback. everything prints well.
Are there any changes has been made in core components?
Please help with problem.
Code is as follow:
app.scripts.config.serve_locally = True
app.config[‘suppress_callback_exceptions’] = True
app.layout = html.Div([
html.Button(‘get attributes’,id=‘get_attributes’,n_clicks=0),
dcc.Dropdown(id="select_dep_var"),
html.Div(id = 'store_dep_var'),
dcc.Dropdown(id="drp1"),
dcc.Dropdown(id="drp2"),
])
@app.callback(Output(‘drp1’,‘options’),
[Input(‘get_attributes’,‘n_clicks’),
Input(‘select_dep_var’,‘children’)])
def drp1update(n_click,depend_var):
if n_click > 0:
if depend_var is not None:
return [{‘label’: i, ‘value’: i} for i in data[depend_var].unique()]
@app.callback(Output(‘drp2’,‘options’),
[Input(‘get_attributes’,‘n_clicks’),
Input(‘select_dep_var’,‘children’)])
def drp2update(n_click,depend_var):
if n_click > 0:
if depend_var is not None:
return [{‘label’: i, ‘value’: i} for i in data[depend_var].unique()]
@app.callback(Output(‘store_dep_var’,‘children’),
[Input(‘select_dep_var’,‘value’)])
def store_dep_var(dep_var):
return dep_var
@app.callback(Output(‘select_dep_var’,‘options’),
[Input(‘get_attributes’,‘n_clicks’)])
def select_dep_var(click):
if click >0:
print(‘returning attributes in dropdown’)
print(click)
print(data.columns)
return [{‘label’: i, ‘value’: i} for i in data.columns]
if name == ‘main’:
app.run_server(debug=True)