Hi. I have a multi-page application. On one page there is a dropdown, when selecting a value from which the grid loads on this page. I want to switch to another page with a graph, then return to the first page, which will be in the same state as it was. I found a solution with hide/show display. But maybe it can be done using dcc.Store. Has anyone encountered this? And he can share his experience. I would be grateful.Thanks for help
And is it possible to do this if the first page is already loaded by the grid when switching to it (prevent_initial_call is not set)
app.py:
app.layout = dbc.Container(
children=[
dcc.Location(id="url", refresh=False),
navbar,
dbc.Container([], id="page_content"),
],
)
def display_page(pathname):
if pathname == "/":
return page_1.get_layout()
elif pathname == "/page_2":
return page_2.get_layout()
page_1.py:
def get_layout(**kwargs):
layout = [
dcc.Location(id='url1', refresh=False),
dcc.Store(id='state1'),
html.Div([
dbc.Row([
dcc.Dropdown(id='dropdown'),
dbc.Button(id='btn'),
dcc.Loading("here load AgGrid"),
], id='page-content1')
]
I want that when I go to another page and when I return to the first one, I get a page with the dropdown value selected earlier and with the existing grid (loaded earlier). so that the page does not return to the original state of the initial loading