Skip to content

[BUG] Dash 1.6 Datatable disables all callbacks if not in initial layout #1010

@HansKallekleiv

Description

@HansKallekleiv

Describe your context

dash                 1.6.0  
dash-core-components 1.5.0  
dash-html-components 1.0.1  
dash-renderer        1.2.0  
dash-table           4.5.0  

Same issue as #998 .
If DataTable is used in the app but not included in the initial layout callbacks are not working.

Small example using dcc.Tabs below.
Here the first rendered tab has a dcc.Graph which is populated in a callback.
The second tab has a empty DashTable.
With dash > 1.5.1 it is necessary to first navigate to the tab with the DashTable before the callback on the first tab is working.

# -*- coding: utf-8 -*-
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import dash_table

app = dash.Dash()

app.layout = html.Div(
    children=[
        dcc.Tabs(
            children=[
                dcc.Tab(
                    children=[
                        html.Button(id="btn", children="Update graph"),
                        dcc.Graph(id="example-graph"),
                    ]
                ),
                dcc.Tab(children=dash_table.DataTable(id="example-table")),
            ]
        ),
    ]
)

@app.callback(Output("example-graph", "figure"), [Input("btn", "n_clicks")])
def update_graph(clicks):
    return {
        "data": [{"x": [1, 2, 3], "y": [4, 1, 2], "type": "bar"},],
    }

if __name__ == "__main__":
    app.run_server(debug=True)

Describe the bug

If a dash_table.DataTable is included in the app, but not in the initial layout, app callbacks are not working. After the table has been added to the layout the callbacks works correctly.

Expected behavior
The callbacks should work.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions