Hi all, I am working on 3 apps, and wanted to create a dropdown to switch to each of the desired app. I read through the tutorial: https://dash.plot.ly/urls but I don’t want to browse the apps with url, but to use dropdown.
Is there any possible solution/better approach for this situation? Would love to discuss more!
Thanks Ola, this works perfectly!
Use two dcc.Location components. One serves as input, another serves as output. They will sync their value by themselves automatically. Since the input and output components have different names, the callback validation will pass.
dcc.Location(id='url-input'),
dcc.Location(id='url-output'),
@app.callback(Output('url-output', 'pathname'), Input('component-a', 'value'))
def update_url_by_component_a(value):
return f"/{value}"
@app.callback(Output('component-a', 'value'), Input('url-input', 'pathname'))
def update_url_by_component_a(pathname):
return f"{pathname}"