Dear all,
I have a datatable reading the data from the dcc.Store. I want it to be editable such that I can modify the data manually. However, the editing feature is not working.
The code is shown below.
@app.callback(
Output('raw-data-div', 'children'),
[Input('stock-data', 'modified_timestamp'),
Input('data-start', 'n_intervals')],
State('stock-data', 'data'),
)
def gen_data_table(stock_data_timestamp, data_start_n_intervals, stock_data):
if stock_data_timestamp != -1 or data_start_n_intervals is not None:
div_children = []
stock_data = jsonpickle.decode(stock_data)
for symbol, stock in stock_data.items():
df_current_and_others = stock.raw_data['current_and_others']
df_quarterly = stock.raw_data['quarterly']
df_annual = stock.raw_data['annual']
div_children.extend(
[
html.P(id='hihi'),
html.H3(f'{symbol}'),
html.H4('Current and others'),
dash_table.DataTable(
id=f'hihi_{symbol}',
data=df_current_and_others.to_dict('records'),
editable=True,
persistence=True,
),
html.H4('Quarterly'),
dash_table.DataTable(
data=df_quarterly.to_dict('records'),
editable=True,
persistence=True,
),
html.H4('Annual'),
dash_table.DataTable(
data=df_annual.to_dict('records'),
editable=True,
persistence=True,
),
html.Hr(),
]
)
return div_children
else:
return dash.no_update
Please help me. Thank you.