PablocFonseca / streamlit-aggrid

Implementation of Ag-Grid component for Streamlit
https://pypi.org/project/streamlit-aggrid/
MIT License
992 stars 190 forks source link

Columns not filterable or groupable in version 1.0.5 #286

Closed toliver38 closed 1 week ago

toliver38 commented 1 week ago

Using version 1.0.5 of streamlit-aggrid, I noticed that the columns are no longer filterable or groupable even when setting the options explicitly. Below are two examples that illustrate the issue:

Example 1

from st_aggrid import AgGrid, GridOptionsBuilder

samplesdf = pd.DataFrame({
    "Suffix": ["Jr", "Sr", "III"],
    "First Name": ["John", "Jane", "John"],
    "Last Name": ["Doe", "Doe", "Doe"],
})

gb = GridOptionsBuilder.from_dataframe(samplesdf)
gb.configure_default_column()
gb.configure_column("Suffix", filter="agTextColumnFilter")
AgGrid(samplesdf, gridOptions=gb.build())

Example 2

import pandas as pd
from st_aggrid import AgGrid, GridOptionsBuilder

dataframe = pd.DataFrame({
    "Suffix": ["Jr", "Sr", "III"],
    "First Name": ["John", "Jane", "John"],
    "Last Name": ["Doe", "Doe", "Doe"],
})

grid_builder = GridOptionsBuilder.from_dataframe(dataframe)
grid_builder.configure_side_bar(filters_panel=True, columns_panel=True)
grid_builder.configure_default_column(
    resizable=True,
    filterable=True,
    sortable=True,
    editable=False,
    pivot=True,
    groupable=True,
)
update_mode = GridUpdateMode.VALUE_CHANGED
grid_options = grid_builder.build()

AgGrid(
    dataframe.head(50),
    gridOptions=grid_options,
    update_mode=update_mode,
    enable_enterprise_modules=True,
    key='example2',
)

Expected Behavior

In both examples, the columns should be filterable and groupable as specified in the configuration.

Actual Behavior

The columns are neither filterable nor groupable, the sidebar menu shows filters but no columns are listed even though the options are set correctly. Additional Information

Streamlit version: 1.36.0
Python version: 3.11
Streamlit-AgGrid version: 1.0.5
toliver38 commented 1 week ago

Resolved my issue. It was due to using filterable vs filter


        # makes columns resizable, sortable and filterable by default
        resizable=True,
        filter=True,
        sortable=True,
        editable=False,
        pivot=True,
        groupable = True,
        enableRowGroup=True,
        enablePivot=True,
    )```