New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Coming soon] Allow dataframe rows to be selectable and trigger a function in Python code #688
Comments
Hi @timforr -- Thanks for the feature request! This seems like a natural progression for Streamlit, pending some conversation within the team of course. |
Do we have an update on this? |
Yes this functionality would be very extremely useful! I would be keen to know if there is an update . Thanks! |
I have found myself multiple times over the past year needing this -- I am surprised it is still not implemented! Something as easy as |
Is there any workaround until this enhancement is completed? |
Any update on this? It would be really useful to be able to click on a specific cell/row and have that trigger an event in Python to update the page. |
I need this too. Just a simple (Checkboxes on each row would also be an alternative, though in my case I don't need multiselect) |
This would unlock a lot of interesting use cases. Typically data is presented in a table. Being able to click would enable pivoting views which is common operation on data. |
Hi all, any update on this? |
We're working on this at the moment. No concrete launch data but we should have something during the next few months! |
Might be able to use newly added feature to cover this issue. |
How does editing cells in the table allow to react to a clic or to know which row has been selected? These are different use cases. |
Yes, true. Based on examples in https://docs.streamlit.io/library/advanced-features/dataframes?ref=streamlit it seems possible using the session state (though maybe not yet straight forward). If not, the Next Up section in the original link states a more straight forward way to do this should be here soon:
|
st.dataframe is getting so much better now, i think with returning clicked row selection feature we will not need the st aggrid for most use cases, looking forward thanks a lot!! |
Hi, checking it to see if there's an update to this beyond the |
UpdateSee my comment here. |
The checkbox work around helps, but requires the user to unselect the row before selecting a new one if you are trying to just select one row. Also you have to add a new checkbox column and are not able to click anywhere on the row. The click a row and then call a function with row index would be really useful. Thanks. |
@chuckpaulson Agree, the checkbox "works" but is a poor option if the user should only be able to select 1 box (there are many use cases for this). I have a nasty hack where whenever a user selects a checkbox, I use the st.data_editor's callback to a function which resets all the checkboxes in the column. This has a bad side effect where it undos any table filtering/sorting the user may have done. @jrieke It would be really awesome if we could somehow get this feature prioritized (I know it's on your roadmap but it seems like its still quite a few months out). For example, even a simple optional parameter to the |
Hi @jrieke any updates on this? |
Any updates on this? |
Hey all! We're just starting to pick this feature back up and are planning to build a first prototype by the end of April. I'll update here once I have more news about the status or the API. |
Hi, |
We just finished a very rough prototype for dataframe selections: https://dataframe-row-selections.streamlit.app/ Feel free to give it a try but note that it's still under active development, so things might and will change! Let me know if you have any feedback. For a broader picture on selection events, see my comment here. |
Quick update: we're quite advanced on the prototype I posted above, as well as on the API discussions. We're currently planning to release dataframe selections for both rows + columns sometime in |
## Describe your changes This PR adds row and column selection support to `st.dataframe`. It can be used like this: ```python selection = st.dataframe( df, on_select="rerun", selection_mode="single-row" ) ``` - [Demo App](https://dataframe-row-selections.streamlit.app/) https://github.com/streamlit/streamlit/assets/2852129/f3ff476a-0bd0-4b82-bc97-6bda3a3be98c ## GitHub Issue Link (if applicable) - Closes #688 - Closes #7134 - #455 - #8319 ## Testing Plan - Added unit tests - Added e2e tests (see #8634) ```[tasklist] ### e2e tests - [x] Single row/column selection - [x] Multi row/column selection - [x] Mixed selections - [x] Screenshot of a dataframe with multiple selections - [x] Clear selections via toolbar - [x] Clear selections via escape - [x] Select all rows in multi-row selection via top checkbox - [x] Optional: Test drag and drop selection - [x] Optional: Test shift selections - [x] Optional: Test selections in form - [x] Have some test cases work with session state and others with return value - [x] Add a test case validating that the callback gets called ``` --- **Contribution License Agreement** By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license. --------- Co-authored-by: Benjamin Räthlein <benjamin.raethlein@gmail.com>
We will release row & column selections for selection = st.dataframe(df, on_select="rerun", selection_mode="single-row") Or for multi-row & column selections: selection = st.dataframe(df, on_select="rerun", selection_mode=("multi-row", "multi-column")) You can try it out in this demo. |
@LukasMasuch - thanks for the demo, this will be great for our application! |
Thank you soo much for this update. @LukasMasuch can you let us know when streamlit is planning to release version 1.35? It will be very helpful. |
@rutuja1409 Probably today or tomorrow :) |
Problem
I have a st.table displaying search results. I want to be able to click on a specific row (or select several rows) and have that trigger an event in Python to update the page.
Solution
MVP: Table rows are clickable and trigger a custom event
Possible additions: What are other things that could be added to the MVP over time to make it better?
Preferred solution: More fully-featured solution similar to DTTables where we can specify custom table styling, embed objects like images in to table cells, select multiple rows or cells, etc.
Community voting on feature requests enables the Streamlit team to understand which features are most important to our users.
If you'd like the Streamlit team to prioritize this feature request, please use the 👍 (thumbs up emoji) reaction in response to the initial post.
The text was updated successfully, but these errors were encountered: