✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🧬 Learn how to build RNA-Seq data apps with Python & Dash. Register for the May 20 Webinar!

Looping through dynamic number of input IDs in call back

I have dynamically built hyperlinks(in sidebar) with one for each file uploaded. Now I want to load corresponding table when a hyperlink is clicked. e.g if link3 is clicked, I load that corresponding data as dash table. I have stored the data of uploaded file in hidden div. My question is how to I check which link is clicked(I have IDs as index increment).

I was thinking I would use MATCH pattern on the link ID and n_clicks, but the error is popping up that I don’t have MATCH pattern on the output. The output is nothing but just a single div placeholder to load any single table. So I don’t have anything to match to in the output vs input. Any suggestions? Here is the callback snippet for which I am getting error. It is not complaining when i use ALL pattern, but how can we be sure that indices are coming in same order. MATCH would ensure correct match, not sure in ALL, if the order is maintained for both ID and click inputs.

@app.callback(
    Output("page-content", "children"),
    [Input("filelist-uploaded-data-store", "children")],
    [State({'type': "submenu_link", 'index': ALL}, "n_clicks"),
     State({'type': "submenu_link", 'index': ALL}, "id")])