Hello All,
Very new to dash…experiment multi pages app with usage of dcc.Store component.
Store component is loaded in one page, noticed ‘store’ looks empty in the other page.
Then, no dropdown displayed…
type -- <class 'dict'>
data.keys() -- dict_keys([])
I get following error message:
TypeError: fn_dropdown_continent() missing 1 required positional argument: 'continent'
dash.register_page(__name__,
path='/',
location="sidebar")
layout = dbc.Container([
dbc.Row([
dbc.Col([
html.H2('Full table'),
html.Br(),
html.Br(),
html.Hr(),
dash_table.DataTable(data=[] , id='full-table', fixed_columns={'headers':True, 'data':1})
]),
]),
dbc.Row([
dbc.Col([
html.H2('dropdown'),
dcc.Dropdown(id='dropdown-continent', options=[], value='Europe')
]),
]),
])
@callback(
[Output('full-table', 'data'),
Output('full-table', 'columns')],
Input('store', 'data'))
def fn_full_table(data):
print(f'type -- {type(data)}')
print(f'data.keys() -- {data.keys()}')
df = pd.DataFrame(data)
return df.to_dict('records'), [{"name":i, "id": i} for i in df.columns]
@callback(
Output('dropdown-continent', 'options'),
[Input('store', 'data')
])
def fn_dropdown_continent(data, continent):
df = pd.DataFrame(data)
df_cont = df[df['continent'] == continent]
return list(df_cont.unique())
Many thanks for your help on this,