I want to avoid some outputs to change, I know the raise update works, but somtimes is not possible to use it.
I’m in trouble with State() modes, my app don’t work with same State() and Output() in the same callback!
In the code I want to avoid the “*” to update the output:
@app.callback(
[Output('layer', 'data'), Output('column', 'data'), Output('state', 'data'), Output('city', 'data')],
[Input('dropdown1', 'value'), Input('map1', 'clickData'), Input('map2', 'clickData')]
)
def input_elements(value, map1clickData, map2clickData):
change_id = dash.callback_context.triggered[0]['prop_id']
if 'dropdown' in change_id:
return *, value, *, *
if 'map1' in change_id:
layer = 2
state = str(json.dumps(map1ClickData['points'][0]['location']).strip('"'))
return layer, *, state, *
if 'map2' in change_id:
layer = 3
city = str(json.dumps(map2ClickData['points'][0]['location']).strip('"'))
return layer, *, *, city
@app.callback(
[Output('divMapa', 'children'), Output('graph1', 'figure')],
[Input('layer', 'data'), Input('column', 'data'), Input('state', 'data'), Input('city', 'data')]
)
def output_elements(layer, column, state, city):
change_id = dash.callback_context.triggered[0]['prop_id']
if 'column' in change_id:
if layer == 1:
...do something
return map1, graph1
if layer == 2 or layer == 3:
...do something
return map2, graph1
if 'state' in change_id:
if layer == 1:
...do something
return map1, graph1
if layer == 2 or layer == 3:
...do something
return map2, graph1
if 'city' in change_id:
if layer == 1:
...do something
return map1, graph1
if layer == 2 or layer == 3:
...do something
return map2, graph1
If is possible to help me implement this, anyway thak you!