Dash DataTables, Flask, and Route Variables


I’m trying to hook up Dash DataTables with a dataset API (GET only) that allows users to interact with the dataset. This would require a user to pass through keywords for the datasets they are looking for through the URL. The list of these datasets would also be added and subtracted over time, so hard coding each layout/route is out of the question.

Is there a way (either using flask as the server, or a specifically Dash-based app) that would allow for this kind of dynamic routing and loading of datasets? Or am I better off just using JQuery DataTables?

Thank you,

I’m not sure if this is what you are looking for, but I think if it’s the same app but just different URL query parameters then then you can inspect the dcc.Link at callback time and flask.request.headers.get('Referer', '') at layout time.

Examples of URL handling examples at callback time here: https://dash.plot.ly/urls

And I have a couple of examples of doing the same but at layout time here: Example: Creating Multi-Page and Custom-Page apps at layout time

I don’t know if this helps, but the dcc.Location component has a search property that should return the args passed to the URL (https://github.com/plotly/dash-core-components/blob/master/dash_core_components/Location.py).

You could build some logic into a callback that uses this property as an input and returns a data table

Here’s my current recipe for propagating query parameters from the URL into a URL router if it’s of any help: