Multiple output from one input

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:

working 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)
2 Likes

oh, It’ works… and… also my code works… I’m sorry for my bad…