Hello,
I have a multiselect with a single default option, because it is required for the app to work. I wrote a callback to capture when the user deleted the default and warned them that it would be added back to the selected list. However, this does not work.
st.multiselect("RANK BY",
key="q_rank_by",
default=st.session_state["q_rank_by_default"],
options=self._rank_by_column_options(),
max_selections=5,
on_change=self._callbacks.query_rankby_changed)
def query_rankby_changed(self):
if 'SERIAL_NUMBER' not in st.session_state.q_rank_by:
alert_user(self._messenger, level='warning', msg="The rank-by argument must contain the 'SERIAL_NUMBER' column, adding it back in")
st.session_state.q_rank_by.insert(0, 'SERIAL_NUMBER')
I know I could just hard-code SERIAL_NUMBER and only allow users to add to it, but I would like it visible, so the user knows it is being selected.
thx