Hello,
I have an app where multiple controls (textInputs, dropdowns, etc) write information into a dcc.Store (addressMemory in the following example) to keep track of all the values. This works perfect when user introduces the data as he/she operates with one control at a time.
My problem arises when I try to upload a predefined configuration automatically. This executes a callback that updates all the control’s values at once. This executes individually every control’s callback but the dcc.Store finally gets only the value of the last control to execute its callback.
The example show what I try to expose, when executing the function bulkSetting, both callbacks (change_spiMode and change_crcMode) are executed but the dcc.Store addressMemory will endup with only one of the changes…
@callback(
Output("addressMemory", "data", allow_duplicate=True),
[
Input("spiMode", "value"),
],
State("addressMemory", "data"),
prevent_initial_call=True,
)
def change_spiMode(spiMode,addressMemory):
if spiMode:
addressMemory["0x00"]["custom"]="0x{:02x}".format(int(spiMode,2))
else:
addressMemory["0x00"]["custom"]=addressMemory["0x00"]["default"]
return no_update
return addressMemory
@callback(
Output("addressMemory", "data", allow_duplicate=True),
[
Input("crcMode", "value"),
],
State("addressMemory", "data"),
prevent_initial_call=True,
)
def change_crcMode(crcMode,addressMemory):
if crcMode:
addressMemory["0x10"]["custom"]="0x{:02x}".format(int(crcMode,2))
else:
addressMemory["0x10"]["custom"]=addressMemory["0x10"]["default"]
return no_update
return addressMemory
def bulkSetting():
set_props(spiMode,{'value':"{0:08b}".format(int(value,16))})
set_props(crcMode,{'value':"{0:08b}".format(int(value,16))})
I wonder if there is any way to perform the callback execution sequentially so that the dcc.Store for the second callback is the one outputted by the first and so on…
Thanks a lot in advance!!