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

Enable User Column Filters #98

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

kmcentush
Copy link

@kmcentush kmcentush commented Jun 7, 2022

For my specific use case, there is a huge advantage to letting my users ultimately export their current column filters and later re-upload them. This can shortcut a lot of manual filtering if the user does pretty routine analysis.

This pull request exposes the ability to both read/write the column filters through the Ag-Grid enterprise setFilterModel and getFilterModel functions. On instantiation (or whenever the AgGrid Streamlit component key changes), these column filters can be applied automatically for the user. After the user filters the data, their filters can be accessed through the new column_filters field in the component value/response.

Please let me know if you have any questions. Happy to create a minimal Streamlit example if my use case is not clear.

Edit: I also fixed a bug in the text_columns aspect of the cast_to_serializable function. That is unrelated to the specific use case here, but I did encounter it while making this PR.

@kmcentush kmcentush changed the title Enable User Column Filters on Instantiation Enable User Column Filters Jun 7, 2022
@kmcentush
Copy link
Author

@PablocFonseca other than resolving the merge conflicts, is there anything else you would want before merging this PR?

@laky55555
Copy link

Hi @kmcentush,
Do you think adding the feature of retrieving current filters would be easy to add?
The use case would be to persist the same filters after the underlying data changes.

@kmcentush
Copy link
Author

kmcentush commented Mar 8, 2023

Hi @laky55555, that's more or less what I did by making these tweaks to the source. You can keep the filters in the streamlit state and apply it whenever the data changes, etc.

Here's the branch I was using in my own setup: https://github.com/cuberg-inc/streamlit-aggrid/commits/feat/col_filters

@PablocFonseca PablocFonseca changed the base branch from main to dev February 15, 2024 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants