[Share] Visdcc - a dash core components for vis.js network

Thanks tho.
This issue happened to someone who used custom component with Multi-Page Apps before.
Custom component with Multi-Page Apps

The reason for this type of error is (from @chriddyp) :

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 of 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.

So the solution for fixing this kind of problem when constructing multiple pages with visdcc (in this case) is adds the following code to the Index.py :

app.layout = html.Div([
    dcc.Location(id='url', refresh=False),
    html.Div(id='page-content'),
    html.Div(visdcc.Network(id='net',
             options = dict(height= '600px', 
                                    width= '100%',
                                    physics={'barnesHut': {'avoidOverlap': 0}},         
                                    )),style={'display': 'none'})
])

:wink:

1 Like