plotly / dash-table

OBSOLETE: now part of https://github.com/plotly/dash
https://dash.plotly.com
MIT License
420 stars 72 forks source link

TypeError: o is null #675

Closed Jaudouard closed 4 years ago

Jaudouard commented 4 years ago

Hello,

I have recently met a new problem working with Dash Data tables. I've been using this library extensively for a while (many thanks for all of this!), and this is the first time I don't know how to work around an issue.

My dash* libs:

dash==1.7.0 dash-bootstrap-components==0.7.1 dash-core-components==1.6.0 dash-cytoscape==0.1.1 dash-daq==0.2.1 dash-html-components==1.0.2 dash-renderer==1.2.2 dash-table==4.5.1

Running this code

import dash
import dash_html_components as html
import dash_table as dte
from dash.dependencies import Input, Output

app = dash.Dash(__name__)

app.layout = html.Div(
    children=[
        dte.DataTable(id="my-table", columns=[
            {
                "id": "column_id",
                "name": "COLUMN NAME",
            }],
                      data=[{
                          'column_id': 15295}]),

        html.Button(
            "UPDATE TABLE",
            id="trigger_callback",
            type="submit",
        ), ]
)

@app.callback(Output("my-table", "data"),
              [
                  Input("trigger_callback", "n_clicks")
              ])
def feed_data_callback(click):
    if click and click > 0:
        return [{'column_id': 15298}]

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

produces an error in the JS console (o is null with Firefox). image

The table is initialized alright with the proper value, but the callback doesn't update the data table. It is fired, but doesn't update the table.

Have you seen something like that before, and do you have an idea of what could be wrong?

Many thanks for all, true Dash fan here!

Jaudouard commented 4 years ago

OK, sometimes asking a clear question helps finding a clear solution! I've just realized that removing the if click and click > 0: in the callback solves the issue. Closing this, sorry (but big thanks still!)