Black Lives Matter. Please consider donating to Black Girls Code today.

How to ADD rows to uploaded dash table?

hi.
I uploaded the dash table and now I want to add rows to it and save it back to the database.

can anyone please help me from this problem?

regards,
Kittu.

1 Like

You can read the documentation https://dash.plot.ly/datatable/editable that mentions adding rows.

@app.callback(
    Output('adding-rows-table', 'data'),
    [Input('editing-rows-button', 'n_clicks')],
    [State('adding-rows-table', 'data'),
     State('adding-rows-table', 'columns')])
def add_row(n_clicks, rows, columns):
    if n_clicks > 0:
        rows.append({c['id']: '' for c in columns})
    return rows
1 Like

That does not work when the table is created by another callback though.