Quantcast
Channel: ЁЯОЫя╕П Dash - Plotly Community Forum
Viewing all articles
Browse latest Browse all 6271
тЖз

Dash Plotly Share Callback Input in another page with dcc.Store

$
0
0

Hi guys,

i have a 2 pages app, on the first page (app.py), i use dcc.Store to store a value in the session cache, and then trying to load this data in the 2nd page (app2.py), and show it as html.H1.

Here is my code in page one:

dcc.Store(id='session', storage_type='session'), 

then my callback on this page is:

@app.callback(Output('session', 'data'),
              [Input('q1', 'value')])
def q1_value(q1):
     return {'answer1value': q1}

while тАЬq1тАЭ is a value from my radioitem.

Then on my 2nd page (app2.py), i call the data out with this:

@app.callback(Output('results', 'children'),
              [Input('session', 'data')]
              )
def result(data):
    math = data['answer1value']
    return 'your answer is "{}"'.format(math)

results is the id of my тАЬhtml.Div(html.H1(id=тАЬresultsтАЭ))тАЭ

But when i run this app, nothing is shown up in this H1. I have spent many hours to fix this but fail, would you one please help ?

1 post - 1 participant

Read full topic

тЖз

Viewing all articles
Browse latest Browse all 6271

Trending Articles