Clickable DataFrame Rows to Trigger a Detailed Display

Hi,

I am using the st.dataframe to display my data.
What I’d like to achieve is to click on a row in this data display element, then show a detailed visual overview of the clicked row in a separate column.

There doesn’t appear to be click callback support.

Example of what I’m looking to achieve:

col1, col2 = st.columns([2, 1])

with col1:
    # The main data display with all entries
    # Use a click callback on a row to show the details of that row
    st.dataframe(ranked_data, height=800, onlclick=show_details)

with col2:
    # Show details of the clicked row.
    active_row = ranked_data.iloc[clicked_row_index]

    # plots, metrics, stats, other visual displays here for that row go here...
    st.metric(label="Score", value=active_row.final_score)
3 Likes

I have done this myself with

If you get stuck I’m happy to take a look, but I’m on mobile at the moment

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.