# Dash table edited data not persisting

**URL:** <https://community.plotly.com/t/dash-table-edited-data-not-persisting/34302>\
**Category:** Dash Python\
**Created:** [January 30, 2020, 4:27am UTC](https://community.plotly.com/t/dash-table-edited-data-not-persisting/34302 "2020-01-30T04:27:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![user123](https://avatars.discourse-cdn.com/v4/letter/u/ed655f/32.png) [@user123](https://community.plotly.com/u/user123)\
**Post date:** [January 30, 2020, 4:27am UTC](https://community.plotly.com/t/dash-table-edited-data-not-persisting/34302/1 "2020-01-30T04:27:21Z")

</div>

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’.

Is it a bug or I am doing something wrong ?

Does the callback have something to do with it ?

This is my test example for later adding code to persist the edited data across tabs. First I have to get this one to work.

This is the code:

```auto
import dash
import dash_core_components as dcc
import dash_html_components as html
import dash.dependencies as ddep
import dash_table as dt
import dash_table.Format as dtfmt

import pandas as pd
import datetime
import random

import dash

app = dash.Dash( __name__ , show_undo_redo=False, url_base_pathname='/'
                ) 
app.config.suppress_callback_exceptions = True

l = [['24-01-2020', 2,3,4], ['25-01-2020', 6,7,8], ['25-01-2020', 17,14,22]]
df = pd.DataFrame(columns=['order_dt', 'channel1', 'channel2', 'channel3'], data=l)

table_columns = [
                    {'name':'Date', 'id':'order_dt', 'editable':False, 'type':'datetime'},
                    {'name':'Channel1', 'id':'channel1', 'editable':False, 'type':'numeric'},
                    {'name':'Channel2', 'id':'channel2', 'editable':False, 'type':'numeric'},
                    {'name':'Channel3', 'id':'channel3', 'editable':True, 'type':'numeric'}
                ]
ord_datatable = dt.DataTable(
                            id='ord',
                            columns = table_columns,
                            data = df.to_dict('rows'),
                            persistence=True,
                            persisted_props = [
                                                'columns.name',
                                                'data',
                                                'filter_query',
                                                'hidden_columns',
                                                'selected_columns',
                                                'selected_rows',
                                                'sort_by'
                                              ],
                            persistence_type = 'local'
                        )

app.layout = html.Div(children=
                                          [
                                              ord_datatable,
                                              html.Button(className='button', id='refresh_button', n_clicks=0, children=['Refresh'])
                                           ])

@app.callback(
                ddep.Output(component_id='ord', component_property='data'),
               [ddep.Input(component_id='refresh_button', component_property='n_clicks')],
                [ddep.State(component_id='ord', component_property='data')] 
             )
def update_data(n_clicks, rows):
    if n_clicks > 0:
        for row in rows:
            print('row={}'.format(row))
        return (rows)
    else:
        return (rows)

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

```

---

<div class="post-metadata">

**Author:** ![user123](https://avatars.discourse-cdn.com/v4/letter/u/ed655f/32.png) [@user123](https://community.plotly.com/u/user123)\
**Post date:** [January 30, 2020, 10:39pm UTC](https://community.plotly.com/t/dash-table-edited-data-not-persisting/34302/3 "2020-01-30T22:39:57Z")

</div>

@tcbegley thank you very much for responding. I have now raised an issue:

> <https://github.com/plotly/dash-table/issues/684>
>
> I am trying to persist the data in a data table. One of the columns (Channel3) is editable. I have specified...
