Hi,.
I’m trying to figure out how to use the Store component… just for something simple… so store a value in the session.
I’ve included the store in the layout like this:
app.layout = html.Div(children=[
# session storage_type is cleared when the browser exit.
dcc.Store(id='session', storage_type='session'),
html.Div(id='output-confirm'),
dcc.ConfirmDialog(
id='confirm',
message='Threshold Exceeded, please confirm',
),
dcc.Graph(id='basic-interactions'),
dcc.Interval(
id='interval-component',
interval=5 * 1000, # in milliseconds
n_intervals=0
),
...etc
Then I’m trying to use it in a callback…
@app.callback([Output('confirm', 'displayed'),
Output('basic-interactions', 'figure')],
[Input('interval-component', 'n_intervals')],
[State('local', 'lastAlert')])
def update_figure(update_num, lastAlert):
But I get an error as follows…
dash.exceptions.NonExistentIdException:
Attempting to assign a callback to the
component with the id “local” but no
components with id “local” exist in the
app’s layout.Here is a list of IDs in layout:
[‘session’, ‘output-confirm’, ‘confirm’, ‘basic-interactions’, ‘interval-component’, ‘click-data’]
Just wondering is my approach wrong? The code example in the docs is pretty confusing. I just want to do something basic… is there a simpler example?
Thanks