Skip to main content

Custom Streamlit AgGrid component with 0.1.5 and greater having major grid options

Project description

Filter Persist

Filter Persist is a custom Streamlit component that integrates AG Grid and enables persistent filtering using a local JSON file.

Built with care by Parshav Shivnani, this component is ideal for dashboards where user filter preferences need to be retained between sessions. With 0.1.5 version it has majority of AG-Grid builder options

🔧 Features

  • Interactive AG Grid component for Streamlit
  • Filters are saved and restored from a JSON file
  • Simple to integrate in any Streamlit workflow
  • No need for AG Grid enterprise modules

📦 Installation

Install the package from PyPI:

pip install filter-persist

Example using python

import streamlit as st
import pandas as pd
import json
from filter_persist import custom_aggrid

# Sample DataFrame
df = pd.DataFrame({
    "name": ["Alice", "Bob", "Charlie"],
    "age": [25, 30, 30],
})

# Load saved filters from JSON file
try:
    with open("filter_model.json", "r") as f:
        saved_filters = json.load(f)
except FileNotFoundError:
    saved_filters = None

st.title("Filter Persist - AG Grid with JSON Persistence")

# Call the component
result = custom_aggrid(
    data=df.to_dict("records"),
    column_defs=[{"field": c} for c in df.columns],
    filter_model=saved_filters,
)

# Save current filter state to JSON file
if result:
    with open("filter_model.json", "w") as f:
        json.dump(result, f)

# Display current filters
st.subheader("Current Filter Model:")
st.json(result)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

filter_persist-0.2.0.tar.gz (672.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

filter_persist-0.2.0-py3-none-any.whl (4.9 MB view details)

Uploaded Python 3

File details

Details for the file filter_persist-0.2.0.tar.gz.

File metadata

  • Download URL: filter_persist-0.2.0.tar.gz
  • Upload date:
  • Size: 672.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for filter_persist-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b0d34e1a119114b0b1f7bb82f42b7381e5ee6d32a26e30d3bc5c6da07f5627ce
MD5 aa6b473cf0b8d47e117a51597c18467f
BLAKE2b-256 8d5d388c789b24e0b316195794098e43513d72d1f34036822886d2933df2908e

See more details on using hashes here.

File details

Details for the file filter_persist-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: filter_persist-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for filter_persist-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8e5f0d2b1cf4b7b2f3ddd05a219fcfb9cf22bbd4e710c735b1f5f4b5921a41fb
MD5 46efe47dbbf88177134b72675cf1b665
BLAKE2b-256 28cf8e12b631c2399b64853c475c83c74904c38e87616b1a521807dcbc1cd164

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page