Hi, I am executing a time-intensive query inside of a callback when clicking a button. During this, I am showing a loading symbol. Additionally, I also want to disable some buttons during this action. I tried with the following code, but with the new dash version it seems to not work.
@app.callback(
[Output('first-button', 'disabled'),
Output('second-button', 'disabled'),
Output('third-button', 'disabled')],
[Input('start-process-button', 'n_clicks'),
Input('process-finished-ack', 'children')]
)
def lock_buttons(n_clicks, end_ack):
context = dash.callback_context.triggered[0]['prop_id'].split('.')[0]
if context == 'start-process-button':
if n_clicks > 0:
return True, True, True
else:
return False, False, False
else:
return False, False, False
@app.callback(
Output('process-finished-ack', 'children'),
[Input('start-process-button', 'n_clicks')]
)
def perform_process(n_clicks):
# do something
return "done"
How can I achieve this using the new dash version? I also tried to put loading symbols for all buttons, but it seems like it is not possible to trigger multiple loading elements as outputs. Are there any alternatives to disable buttons while running a callback?