-
Notifications
You must be signed in to change notification settings - Fork 30
Description
Not able to retains the values selected in previous tab if the users switch b/w the tabs
`from st_on_hover_tabs import on_hover_tabs
import streamlit as st
Initialize session state variables if they are not already set
if 'source_connection' not in st.session_state:
st.session_state['source_connection'] = None
if 'hover_tab' not in st.session_state:
st.session_state['hover_tab'] = 'Table Config'
st.session_state['source_tables_config'] = ['Test1', 'Test2']
Sidebar with hover tabs
with st.sidebar:
hover_tabs = on_hover_tabs(tabName=['Table Config', 'Validations', 'Test Report', 'Others'],
iconName=['engineering', 'rule', 'receipt long', 'share'], default_choice=0)
st.session_state['hover_tab'] = hover_tabs
Display content based on the selected tab
if st.session_state['hover_tab'] == 'Table Config':
st.session_state['source_connections'] = sorted(st.session_state['source_tables_config'])
st.selectbox(
':violet[Select Source Database Name :red[*]]',
st.session_state['source_connections'],
index=None,
placeholder="Source Databases",
key='source_connection'
)
elif st.session_state['hover_tab'] == 'Test Report':
# Add your code for the 'Test Report' tab here
st.write("Test Report content goes here.")
`