arsentievalex / streamlit-dynamic-filters

Custom component with dynamic multiselect filters for Streamlit
MIT License
68 stars 12 forks source link

Expander not working with dynamic filters #9

Open skwskwskwskw opened 6 months ago

skwskwskwskw commented 6 months ago
with st.sidebar:
    st.container()
    st.write("Apply filters in any order 👇")

    with st.sidebar.expander('Location'):    
        dynamic_filters = DynamicFilters(dmz_data, filters=['area_name', 'dmz_name', 'strata', 'classification'], filters_name='dmz_data_filter')
        dynamic_filters.display_filters(location='sidebar')
        #dynamic_filters.display_df()
        dmz_data = dynamic_filters.filter_df()

    selected_area = sorted(dmz_data['area_name'].unique())
    selected_dmz = sorted(dmz_data['dmz_name'].unique())
    selected_strata = sorted(dmz_data['strata'].unique())
    selected_classification = sorted(dmz_data['classification'].unique())

    ## subset data (work order + hydraulic_data)
    with st.sidebar.expander('Months'):
        dynamic_filters_2 = DynamicFilters(hydraulic_data, filters=['month'], filters_name='hydraulic_data_filter')
        dynamic_filters_2.display_filters(location='sidebar')

with st.sidebar:
    st.button('Reset All Filters', on_click=clear_cache)

How to make the expander to interact with the dynamic filters correctly?

jokerdelmar commented 5 months ago

same issue with st.form too

vikashgraja commented 3 months ago

Just remove the "location" parameter.

I guess you would have found it. 😅

kconno13 commented 3 months ago

same issue with st.form too

Also having the same issue with st.form

vikashgraja commented 3 months ago

Also having the same issue with st.form

Kindly share your code