I am trying to disable a button while processing a request in dash. Currently I have this (Display loading symbol while waiting for a result with plot.ly Dash) implemented. I am trying to figure out how can I disable a button while a long query is on going.
Here are the logics that I tried:
Logic 1: (I am receiving Circular Dependecy error)
callack 01:
- input: button n_click
- input: DIV last updated (if DIV children populated, set button disabled to false)
- output: button disabled (if Button no_click set to true)
Callback 02:
- input button n_click
- output DIV last-updated
Logic 2: (error due same output for both CBs)
Callback 01:
- Input Button n_click
- output Button disabled
- output last-update
Callback 02:
- Input last-update children
- Output Button disabled
I also tried dcc.Loading with the button. I can activate the spinner, but the button keeps enabled.
html.Div([dbc.Button("load data", id="but-data", className="mr-2", disabled=False), dcc.Loading(id="loading-1", type="default", children=html.Div(id="loading-output-1"))]),
any suggestion?