Skip to content
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

Select/Deselect All for st.data_editor - st.column_config.CheckboxColumn #8319

Open
2 tasks done
darkb1u3 opened this issue Mar 16, 2024 · 4 comments
Open
2 tasks done
Labels
feature:st.columns type:enhancement Requests for feature enhancements or new features

Comments

@darkb1u3
Copy link

Checklist

  • I have searched the existing issues for similar feature requests.
  • I added a descriptive title and summary to this issue.

Summary

Would like to be able to select/deselect all when using "st.column_config.CheckboxColumn" in st.data_editor.

Similar to how it works when using "num_rows=dynamic". (But I dont want to have dynamic rows)

Why?

This is mostly to make it easier when interacting with large df's where multiple cells/checkboxes have to be selected (and not for the purpose of removing rows etc like with "num_rows=dynamic").

How?

There should be a checkbox in the label field of the chekbox column. When checked, it would check all the checkboxes in the column, and then deselect all checked boxes if clicked again.

Additional Context

No response

@darkb1u3 darkb1u3 added the type:enhancement Requests for feature enhancements or new features label Mar 16, 2024
Copy link

To help Streamlit prioritize this feature, react with a 👍 (thumbs up emoji) to the initial post.

Your vote helps us identify which enhancements matter most to our users.

Visits

@darkb1u3 darkb1u3 changed the title Select/Deselect All for st.data_editor - st.column_config.CheckboxColumn [Feature Request] Select/Deselect All for st.data_editor - st.column_config.CheckboxColumn Mar 16, 2024
@LukasMasuch
Copy link
Collaborator

@darkb1u3 Thanks for the feature request. We plan to add official support for row selection soon using the same checkbox row as used when "num_rows=dynamic". I assume this will likely fulfill your feature request, or?

The related issue is: #688

@darkb1u3
Copy link
Author

Yes, as long as you will be able to select all (all checkboxes in column) with one click.

@jrieke jrieke changed the title [Feature Request] Select/Deselect All for st.data_editor - st.column_config.CheckboxColumn Select/Deselect All for st.data_editor - st.column_config.CheckboxColumn Mar 16, 2024
@LukasMasuch
Copy link
Collaborator

We will release row & column selections for st.dataframe in the 1.35 release. The row selections will provide a way to select/deselect all rows via checkbox in the header. It can be used like this:

selection = st.dataframe(df, on_select="rerun", selection_mode="multi-row")
Screen.Recording.2024-05-13.at.13.44.22.mov

LukasMasuch added a commit that referenced this issue May 13, 2024
## 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature:st.columns type:enhancement Requests for feature enhancements or new features
Projects
None yet
Development

No branches or pull requests

2 participants