This repository was archived by the owner on Jun 4, 2024. It is now read-only.
This repository was archived by the owner on Jun 4, 2024. It is now read-only.
DataTable error when combined with dcc.Tabs #406
Open
Description
I'm getting an error when creating a DataTable in an app that uses tabs. I found a similar issue that was popping up when it was still dash_table_experiments
and was able to get a solution to this problem from this community post. That said, I wasn't certain if this is still a bug or not as it looked like this was resolved when dash_table
got released and I haven't been able to see any other issues come up for this.
You can reproduce with this minimal example:
import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_table
import pandas as pd
app = dash.Dash(__name__)
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/solar.csv')
app.layout = html.Div([
dcc.Tabs(
id='tabs',
children=[
dcc.Tab(
label='Tab one',
children=[
dash_table.DataTable(
id='table',
columns=[{"name": i, "id": i} for i in df.columns],
data=df.to_dict("rows"),
)
]
),
dcc.Tab(
label='Tab two',
children=[
html.H1('This is tab two')
]
)
])
])
if __name__ == '__main__':
app.run_server(debug=True)
My fix was to create a dummy datatable on the second tab like so:
dcc.Tab(
label='Tab two',
children=[
html.H1('This is tab two')
html.Div(
dash_table.DataTable(data=[{}], columns=[]),
style={'display': 'none'})
]
Here are the console error messages I'm getting
Error on FF v66:
NotFoundError: Node was not found [email protected]:12
Error on Chrome v73:
[email protected]?v=0.21.0&m=1552054944:12 Uncaught DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.
Environment
dash 0.40.0
dash-core-components 0.45.0
dash-html-components 0.15.0
dash-renderer 0.21.0
dash-table 3.6.0