Click events using auto-generated ids on a callback

Hi guys, I share this problem if anyone has an idea to solve it I apreciate it.

I have an automatic-generated ids from a list, to create a tree-checklist:


# Tree Wells List
@app.callback(
    Output("tree_wells", "children"),
    [Input('style_options', 'value')])

def update_tree(style_options):
    pozos = available_logs
    
    def pozo(i):
        return html.Details(
                [
                    html.Summary(
                        html.A(children=[i], className='well_style',
                                id=i),
                    ),
                    html.Div(
                        [
                            dcc.Checklist(
                                id='well_checklist',
                                options=[
                                    {'label': 'Select', 'value': 0},
                                    {'label': 'SP', 'value': 1},
                                    {'label': 'Rt', 'value': 2},
                                    {'label': 'GR', 'value': 3},
                                ],
                                #value = [0,1],
                                #labelStyle={'display': 'inline-block'}
                            ),
                            
                        ],
                        style={'text-indent':'2em'}
                    )
                ]
            ),
    def bucle():
        lis = []
        for i in pozos:
            fig = pozo(i)
            lis.append(html.Div(fig))
        return lis
    
    return html.Div(
        bucle(),
        className='tree_div',
        style={'margin-top' : '30px'}),

Captura

After this, I’m trying to create a callback that gives me the name of the id, every time I click on the html.A, something simple like this:

@app.callback(
    Output("nombre_pozo", "children"),
    [Input('i', 'n_clicks')])

def update_plot(pozos):
    return pozos

It´s not working. I have tryed using an specific id gererated by the bucle and works, but I need to call all the ids.

Any ideas are wellcome…
Thanks

Not sure I totally understand what you want todo, but if you generate ids you probably want to use pattern-matching callbacks: https://dash.plotly.com/pattern-matching-callbacks