Basic table as clickable selector?

I’m new to streamlit and still navigating the docs and search etc.

So far certain things seem easy but this one seems hard and I want to make sure I’m not simply missing some docs.

A very typical use case is to do something like df.groupby(‘possibly_high_arity_categorical’).size() and then use the top 50 entries as a table with group value that are clickable to filter other things.

I am struggling to find a good way to do clickable tables or charts (for selecting a categorical).

There are selects that work well, but would be nice to have things enriched. For example you might have hierarchies and do df.groupby([‘parent’, ‘child’]).size() and use that to drill in to views.

I have found you can use markdown lists and print the entire table as markdown but that is not great as you then have a static markdown table with no scrolling etc.

Feels like I’m missing a doc section or something as this is like the first thing one typically implements in these kind of frameworks.

Hi @nobodywillobserve one way to achieve this is to use a customer component streamlit–aggrid GitHub - PablocFonseca/streamlit-aggrid: Implementation of Ag-Grid component for Streamlit. Alternatively, can also implement to a dropdown selectbox for your categorical columns

I think aggrid only does row selection. And not cell click events but could be wrong.

Overall it feels strange this is not a prime target of streamlit as it is such a fundamental flow in any dashboards I create. I imagine most of streamlits users are just doing graphics stuff or nlp and not dealing with structured data.

You can try using the streamlit_elements.mui module. Data Grid can implement cell click callback events, but it may take you some time to learn it, come on!:point_down:
:sparkles: Streamlit Elements - Build draggable and resizable dashboards with Material UI, Nivo charts, and more! - :jigsaw: Streamlit Components - Streamlit

1 Like

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