Hello,
I am new to streamlit and I am trying to reset the select box to the original state once there is a change in the multiselect options. Below is the code I am using:
text = st.sidebar.selectbox(
options=["", "text1", "text2"],
format_func=lambda x: "Select a text" if x == "" else x,
)
def multiselect_on_change():
text = None
multi_select = st.multiselect(
"Choose an option",
["option1", "option2", "option3", "option4"],
["option1"],
on_change=multiselect_on_change
)
Now in the start, selectbox
shows Select a text
and I am selecting text1
in select_box
and option1
and option3
in multiselect
and then do something. After this, I am removing option1
from the multiselect
through the UI and now I want to reset selectbox
to Select a text
.
Is there any way I can achieve this? Thanks in advance for any help.