hello Sir, Nice weather~!!
I’d like to do like this
@callback( # 1: n
Output({‘type’: ‘output’, ‘index’: ALL}, ‘children’),
Input(‘btn’, ‘n_clicks’),
prevent_initial_call=True
)
it doesn’t works…
do you know the best way..?!
hello Sir, Nice weather~!!
I’d like to do like this
@callback( # 1: n
Output({‘type’: ‘output’, ‘index’: ALL}, ‘children’),
Input(‘btn’, ‘n_clicks’),
prevent_initial_call=True
)
it doesn’t works…
do you know the best way..?!
Hello @nicobockko what did you try?
If you feel like cheating, here an example:
from dash import Dash, Input, Output, html, ALL, ctx
count = 10
app = Dash(__name__)
app.layout = html.Div(
[
html.Button(id='btn', children="click"),
html.Div(
[
html.Span(f'Span_{idx}', id={'type': 'span', 'index': idx})
for idx in range(count)
],
)
]
)
@app.callback(
Output({'type': 'span', 'index': ALL}, "children"),
Input("btn", "n_clicks"),
prevent_initial_call=True
)
def do(_):
trigger_id = ctx.triggered_id.index
return ["updated"] * count
if __name__ == '__main__':
app.run(debug=True)