Forums

Running code based on clicking on table row

My Flask app generates a pandas dataframe which is converted to an html table that is formatted using a CSS style sheet. I'd like the user to be able to double click on a row in the table, which would cause some python code to be run based on which row is clicked on (and ultimately result in opening up a pop-up window displaying a new (different) table generated from that code). Is that possible?

It's not impossible, but it sounds pretty hard...

Just to add a little to that: if you want client-side interactivity in a web page, you should take a look at the various JavaScript UI frameworks out there. You can write the stuff that runs in the browser in JS, and have it talk to your Python flask backend using a REST API. That's what we do for our interactive stuff, and it's working pretty well for us. We're using React, but other frameworks that are definitely worth a look at Angular 2 (not Angular 1) and Vue.