Can I make a dash table input into a callback?

I tried some code like this

@app.callback(
    Output('feature_importance_graph', 'figure'),
    Input('datatable-interactivity', 'table1')
)
def streamFig(table1):
    print(table1)
    ....

And I get this error

Property "table1" was used with component ID:
  "datatable-interactivity"
in one of the Input items of a callback.
This ID is assigned to a dash_table.DataTable component
in the layout, which does not support this property.
This ID was used in the callback(s) for Output(s):
  feature_importance_graph.figure

I think this suggest that tables are not usable as inputs to callbacks right?

Hi @xiaodai and welcome to the Dash Community! :slightly_smiling_face:

The properties of the DataTable can absolutely be used as inputs to a callback. :confetti_ball: You just need to use a valid table property - such as “data” or “columns” or one of the many other many table properties. ('table1' looks like it might be an id ?)

If you post a little more code - like a minimal example that will reproduce the error, it will be easier to help. See more information here: How to Get your Questions Answered on the Plotly Forum

I see. You just can’t put the whole table as an input I guess. I saw some examples on the repo.

Thanks for the reply.

Yes, as of Dash 2.0 you can use the “whole table” as an input rather than the component’s id, but you still need to specify which table property triggers the callback. So the first element of the Input is the table (or it’s id) and the second element is the property. And as I mentioned previously, if you post a little more code, it would be easier to help.