Hey guys
I’m looking for a way to determine when a selectbox is used. After that and only after that i want other functions to take action.
I have been using the key option for a reset button but if used to run or not run the filter as below this would always run the filter upon refresh because of the default value being “Any”. But what i need is that the filter function only runs when a change within the selectbox is made.
I hope i could make it somewhat clear what i’m trying to achieve.
Steps to reproduce
st.cache_data()
pulls a dataframe which uses index as parameterIndex = st.sidebar.selectbox(‘Index:’,[‘Any’,‘A’, ‘B’,‘C’],key=‘Index’)
#Reset Button
def reset():
st.session_state.Index = ‘Any’
st.sidebar.button(‘Reset Filters’, on_click=reset)#I want to achieve is something like:
if Index:
st.cache_data.clear()if Index:
run filter functionelse:
dont run filter function