In my app I’m changing table values based on GIS data selected earlier in the application process. The updated values are read from a JSON file.
I can successfully change the table data with the callback below but it is not changing the State of the data. I can tell because I have another callback that later reads ine table States and prints the data to a JSON file.
If I manually edit the editable table then the State changes and I can see this with the JSON output file.
How do I change the State 'data’
@app.callback(
[Output(weather_table_id, 'data'),
Output(tds_table_id, 'data')],
[Input('initialize', 'children')],
[State(weather_table_id,'data'),
State(tds_table_id,'data')]
)
def update_map_variables(z, weather_tbl, tds_tbl):
'''
Update tables with variables passed in from the map.
Necessary because data was initially loaded before
variables were chosen in the GIS-map part of the app.
Over-writes table values when the model parameters
page loads on the users screen.
'''
map_dict = helpers.json_load(cfg.map_json)
weather_file = map_dict.get('file_name')
tds_value = map_dict.get('FeedC_r')
#indexes were calculated earlier in the code
if weather_file:
weather_tbl[wf_index]['Value']=str(weather_file)
if tds_value:
tds_tbl[tds_index]['Value']=tds_value
return (weather_tbl,tds_tbl)