Learn how to use Dash Bio for next-gen sequencing & quality control. 🧬 Register for the Oct 27 webinar.

No data returned for table and no callbacks triggered

I am trying to use selected_row_indices in a callback, following a bunch of examples from the forum. But clicking on the cells does not trigger any callback and the initial callback when loading the page as well as callbacks triggered by Intervals will return None as input data

import dash_table as dtbl

dfext = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/solar.csv')

app.layout = html.Div([
    dtbl.DataTable(
        id='datatable',
        columns=[{"name": i, "id": i} for i in dfext.columns],
        data=dfext.to_dict('records'),
        row_selectable='multi'
    ),
    dcc.Interval(id='refresh', interval=10 * 1000, n_intervals=0),
    html.P(id='dummy'),
])

@app.callback(
    Output('dummy','children'),
    [Input('refresh','n_intervals'),
     Input('datatable', 'rows'),
     Input('datatable', 'selected_row_indices')])
def f(n, rows,selected_row_indices):
    print(selected_row_indices)
    print(rows)
    return []

The callbacks get triggered on the Intervall, but variables printed are

None
None

versions
dash==1.13.4
dash-bootstrap-components==0.10.3
dash-core-components==1.10.1
dash-html-components==1.0.3
dash-renderer==1.5.1
dash-table==4.8.1

Hi @ziczac
You’re DataTable id='table_test but the component id in your input is datatable. Just change one of them so they match

1 Like

Sorry, that was just a mistake when writing the question. While formulating it I tried it again with exactly that example in one of the other questions in the forum and I did not update all part of the question. so, the names/ids are the same. I editedthe question

@ziczac
you need component properties that are actual properties of a datatable.
selected_row_indices and rows do not exist. Maybe you are referring to selected_rows or derived_virtual_data.

See full list of datatable properties.

There’s a difference between the strings that go inside a callback Input and the arguments that go inside the callback function. For a deeper explanation, read this documentation or see this tutorial.

Oh, thanks. I didn’t realize that this here was not an actual working example

Oh, thanks. I didn’t realize that this here was not an actual working example

@ziczac sorry, that example was for a fairly old version of the datatable – it’s gotten significant refactoring.