saurav64bit
saurav64bit

Reputation: 11

Plotly Dash URL routing to id in current page

I am building a webapp querying test results from a sqlite database (# or records in the 1,000s). Most of the time I will have results from > 10 different test methods for a given comparison. Results are displayed as bar graphs, scatter graphs, pictures, etc. It makes for long, linear page and a lot of vertical scrolling before reaching the information your looking for (but at the same time having everything at the same place is what I am aiming at). To limit the scrolling, I managed to put a sidebar and am trying to make hyperlinks in the sidebar jump to the section I want to navigate to. Here is my question: I looked at url routing documentation and at this thread, but could not find a way there to link to a given id=foo in current page. Like it would be done with href=#foo in html. Is there a way to link to a location in current page with dash?

Upvotes: 1

Views: 1976

Answers (1)

emher
emher

Reputation: 6024

Yes, you can do it just like in html. Here is a small example app,

import dash
import dash_html_components as html

app = dash.Dash()
app.layout = html.Div([html.P("Hello world."), html.A("To the end", href="#end")] + [html.Br()]*100 +
                      [html.P("Goodbye world", id="end")])

if __name__ == '__main__':
    app.run_server()

Upvotes: 4

Related Questions