✊🏿 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!

How to capture click events on a table with 100s (maybe 1000s) of links?

Hi there,

So I have an html table which displays rows of information. Each row has the fields:
View: the clickable link,
Start date: start of forecast
End date: end of forecast

The idea is that the clickable link in each row should display a report of sorts in the div just below the table. Which takes us to my problem. Over time, I’d expect this table to have hundreds of rows, so having a callback which listens to the ids of the individual link tags is not practical at all. Add also the fact that this table is updated with new rows each time a forecast is saved, then there’s no easy way to keep track of these link ids.

SO is there a way for me to listen to the clicks in the table and pass some sort of id into a callback dynamically? I’m open to any suggestions or a redesign of a solution to my problem.

I think I figured it out. I could just use Input(‘url’,‘path’) on my callback. The link path will have a unique id which I can then extract to perform a query for the report from a database.

Hello there,

I’m trying to do something similar. I want the user to be able to click on a column containing an ID variable and then be able to retrieve that ID string within Python as an input that I can use as a callback to perform queries on a dataframe where I will print out a filtered table in a div below. Most of the examples I’ve seen only retrieve the number of clicks but not the string.