dash-table icon indicating copy to clipboard operation
dash-table copied to clipboard

Dash table edited data not persisting

Open usser123 opened this issue 4 years ago • 8 comments

I am trying to persist the data in a data table. One of the columns (Channel3) is editable. I have specified persistence=True and persistence_type=‘local’.

When I edit the value in a cell in Channel3 column, then press F5 (to refresh the page), the new value persists only 1 time. If I press F5 again, the new value disappears (the old value appears). So it seems that upon page refresh, the new value is persisted only 1 time. The expected behavior is that the new value should persist across page refreshes as per Persistence documentation for ‘local’.

If it is a bug, it is a high impact bug as it makes persistence unavailable.

Versions of Software:

dash==1.7.0 dash-bootstrap-components==0.7.2 dash-core-components==1.6.0 dash-daq==0.3.1 dash-html-components==1.0.2 dash-renderer==1.2.2 dash-table==4.5.1 plotly==4.4.1 python==3.7.5

usser123 avatar Jan 30 '20 22:01 usser123

@usser123 Did you find any solution? Thank you!

raghavendrajain avatar Apr 11 '20 22:04 raghavendrajain

I still can't get an editable datatable to persist either, ever find a solution?

njlustigpk avatar Apr 13 '20 17:04 njlustigpk

@raghavendrajain @njlustigpk I could not get it to work. I ended up changing my solution design. I used a SQLite database to store the table data in the database. Every time the data table is updated, I used a callback to update the database. In other words, I used a database to persist the data instead of relying on the data table persistence (which does not work).

usser123 avatar Apr 14 '20 00:04 usser123

@usser123 Thanks for the reply, I've decided to use Redis in a similar fashion to how you just described.

njlustigpk avatar Apr 14 '20 00:04 njlustigpk

Now it’s clear why Dash developers do not include dash/tests/integration/renderer/test_persistence.py in CI pipelines

pikhovkin avatar Jun 10 '20 20:06 pikhovkin

Same issue here. I agree with @usser123 it's a high impact issue.

sammo avatar Jun 17 '20 23:06 sammo

I've used a dcc.Store component as an Output and State of the callback to retain the persisted value. Thus, I don't rely on an additional database until this gets fixed. Also, the mechanics of this is closer to the desired behaviour (store in browser userland).

MM-Lehmann avatar Aug 20 '20 11:08 MM-Lehmann

I just tried persistence for DataTable and it seems that this is still an issue:

I made a small test application:

from dash import Dash, dash_table, dcc, html


app = Dash(__name__)


app.layout = html.Div([
    dcc.Input(id="input", persistence=True),
    dash_table.DataTable(
        id="datatable",
        columns=[{"id": "name", "name": "name"}, {"id": "label", "name": "label"}],
        data=[{"name": "Test", "label": "Test"}],
        editable=True,
        persistence=True,
        persisted_props=["columns.name", "data"],
    )
])


app.run_server(debug=True)

Analysing the local storage in Mozilla Firefox I can see an item for the input but not for the DashTable:

grafik

It seems to me that the persistence field has no effect for DataTable. Is there a schedule to get this fixed (as this is already an older issue)?

stlehmann avatar Dec 01 '21 10:12 stlehmann