Sounds like a dumb question but here is the situation:
I have a top navigation bar, in which there are several dcc.Link.
When I click on each of these dcc.Link (which have the “a” tag in my html code), the url pathname is updated with the target page name, and the content of my page is updated. Without refreshing the page.
Now, let’s say a user finetunes the graph, displays what he wants, and mistakely click again on the dcc.Link. The consequence is that it triggers the callback again, and all the “parameters” chosen by this user are reset.
So, I’m trying to disable this dcc.Link/a tag after a user clicked on it a first time.
Ideally, this basic callback:
@app.callback(Output('page-content', 'children'),
[dash.dependencies.Input('url', 'pathname')])
def display_page(pathname):
if pathname == '/homepage':
return homepage
elif ....
return
would have to check first that the current page, the one displayed, is different from the one we ask.
An alternative would be to have a button instead of a dcc.Link, and triggers some Javascript to refresh the url with a window.location.pathname=…
Does anyone here already find a way to do this?