plotly / dash-table-experiments

NO LONGER SUPPORTED - use https://github.com/plotly/dash-table instead
MIT License
174 stars 57 forks source link

Full page doesn't displaying with multiple urls app #18

Closed eirenik0 closed 6 years ago

eirenik0 commented 6 years ago

I have fully working dash app, which I wanna convert to multiple urls app by this instruction https://plot.ly/dash/urls . When I run dash app with single layout, datatbale and graph are displayed, but when I move to multiple urls app, full page where datatable not showing. When I've removed datatable from layout, the rest of content are showing as well. Is it bug or an expected behaviour?

chriddyp commented 6 years ago

This is a bug in the dash-renderer.

A little context: When Dash serves the page, it crawls the app.layout to see which component libraries are being used (e.g. dash_core_components). Then, with this list of unique component libraries, it serves the necessary JS and CSS bundles that are distributed with those component libraries.

In this case, we’re serving dash_table_experiments on a separate page, as the response to a callback. Dash only sees dash_html_components and dash_core_components in the app.layout and so it doesn’t serve the necessary JS and CSS bundles that are required for the dash-table-components component that is rendered in the future.

This is a design flaw of Dash. For now, you can get around this issue by rendering a hidden dash-table-experiments component in the layout like:

app.layout = html.Div([
    html.Div(id='content'),
    dcc.Location(id='location', refresh=False),
    html.Div(dtable.DataTable(rows=[{}]), style={‘display’: ‘none’})
])
eirenik0 commented 6 years ago

@chriddyp Thank you for such quick and useful answer. It's solves my problem.