Hi there!
I was wondering how I could use st.button() and restore multiselect settings back to nonselect/default values?
Sample code:
fruit_list = ["Apple", "Orange", "Kiwi"]
drink_list = ["Apple Juice", "Orange Juice", "Kiwi Juice"]
col1, col2 = st.beta_columns(2)
if st.button("Restore default selections"):
fruit_list = ["Apple", "Orange", "Kiwi"]
drink_list = ["Apple Juice", "Orange Juice", "Kiwi Juice"]
with col1:
selected_fruit = st.multiselect("Select Fruit", options=fruit_list)
with col2:
selected_drink = st.multiselect("Select Drink", options=drink_list,
default=["Kiwi Juice"])
The function attached to st.button() does not work correctly. I didn’t see the lists being reset. Could anyone see my mistakes? Thanks!