-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add song id in url param #8
Comments
Solved here: import streamlit as st
# callback to update query param on selectbox change
def update_params():
st.experimental_set_query_params(option=st.session_state.qp)
options = ["cat", "dog", "mouse", "bat", "duck"]
query_params = st.experimental_get_query_params()
# set selectbox value based on query param, or provide a default
ix = 0
if query_params:
try:
ix = options.index(query_params['option'][0])
except ValueError:
pass
selected_option = st.radio(
"Param", options, index=ix, key="qp", on_change=update_params
)
# set query param based on selection
st.experimental_set_query_params(option=selected_option)
# display for debugging purposes
st.write('---', st.experimental_get_query_params()) |
Solved with session state and callback function |
prototyped in |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Set app status with query params (st.experimental_get_query_params)
The text was updated successfully, but these errors were encountered: