Skip to content

Instantly share code, notes, and snippets.

View enoch-nkm's full-sized avatar

Enoch enoch-nkm

  • Frankfurt a. M.
View GitHub Profile
@Dev-iL
Dev-iL / _streamlit_cell_click_callback.md
Last active November 28, 2024 21:03
Cell click callback workaround in Streamlit 1.36.0 dataframes

Below are my attempts at creating a mechanism to inform Streamlit which specific cell was selected in a dataframe/data_editor. I'm sharing my solution in hope that someone could improve it.


TL;DR: we create a hidden Streamlit control and programmatically interact with it from the JS side. Then, when the callback fires, we retrieve the payload and process it in the "proper" Streamlit flow.

To try it out - run working_workaround.py as a python script (not via streamlit run ...!).