DataTable "data_previous" and "data_timestamp" not set if the DataTable data modified by a callback

Hi,

I came across that ‘data_previous’ and ‘data_timestamp’ values of a DataTable are not assigned unless the user edits DataTable explicitly. If the DataTable is edited by a callback, it’s ‘data_previous’ and 'data_timestamp ’ remain the same. I understood from the documentation that these properties should change if the data is modified by a callback.

My original table is created inside a callback. I have also tried to set data_previous explicitly when the table is created, but it didn’t help either.

I’m using a bit obsolete setup though, is this changed in the recent versions?

dash==0.43.0
dash-bootstrap-components==0.7.0
dash-core-components==0.48.0
dash-daq==0.1.0
dash-html-components==0.16.0
dash-renderer==0.24.0
dash-table==3.7.0

This is still an active problem.

I append an extra row with a callback and the data_previous will not be set correctly.

I use a recent version of dash (dash 1.4.0 and dash-table 4.4.0) and also tried it with the latest.

Here is a minimal example showing the problem:

import json

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

app = dash.Dash(__name__)

table_data = [
    {'A': 1, 'B': 2, 'C': 3},
    {'A': 3, 'B': 4, 'C': 5},
]
columns = [{'id': 'A', 'name': 'A'},
           {'id': 'B', 'name': 'C'},
           {'id': 'C', 'name': 'C'}]

app.layout = html.Div(children=[
    html.H1(children='Hello Dash'),

    html.Div(children='''
        Dash: A web application framework for Python.
    '''),

    html.Button('Add Row', id='adding_rows_button', n_clicks=0),

    dt.DataTable(
        id='test_table',
        columns=columns,
        data=table_data,
        editable=True,
        row_deletable=True,
    ),

    html.Div(id='out_div'),
    html.P(),
    html.Div(id='out_div_prev')
])


@app.callback(
    Output('test_table', 'data'),
    [Input('adding_rows_button', 'n_clicks')],
    [State('test_table', 'data')])
def add_row(n_clicks, rows):
    if n_clicks:
        rows.append({'A': 3, 'B': 4, 'C': 5})
    return rows


@app.callback(
    [Output("out_div", "children"),
     Output("out_div_prev", "children")],
    [Input("test_table", "data")],
    [State("test_table", "data_previous")])
def show_prev(data, data_prev):
    return json.dumps(data), json.dumps(data_prev)


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