blackary/streamlit-keyup

Add on_change keyword?

Closed this issue · 0 comments

Completely a "nice to have" feature.

Add in the ability to use the on_change=function route to trigger functions via session state (st.session_state.text_key) in the same way that other streamlit items work. on_change taking into account the debounce value if set.

i.e.

def some_func():
    df_tofilter = st.session_state.original_df.copy(deep=True)
    st.session_state.filtered= df_tofilter [df_tofilter ['#List'].str.contains(text_key, case=False)]

result = st_keyup(
    'label',
    on_change=some_func,
    key='text_key'
)