Hello All,
New to streamlit and i would like to filter the select box of a table based on another entry select box value.
In the below example i would like to ask if someone can tell me how i pass a filter in the options settings of
“Resource”: st.column_config.SelectboxColumn
so that the user can select only the corresponding persons based on the selection of the “Discipline”.
import streamlit as st
import pandas as pd
data = {
'Employee': ['Person A', 'Person B', 'Person C'],
'Discipline': ['Discpline 1', 'Discipline 2', 'Discpline 1']
}
df_data = pd.DataFrame(data)
# Select discipline
discipline_filter = df_data['Discipline'].unique()
# Define the base columns
base_columns = ['Task', 'Discipline', 'Resource']
# Create an empty DataFrame with the specified columns
df = pd.DataFrame(columns=base_columns)
st.write(df)
edited_df = st.data_editor(
df,
column_config={
"Discipline": st.column_config.SelectboxColumn(
"Discipline",
help="Required Discipline",
width="medium",
options= discipline_filter,
required=True,
),
"Resource": st.column_config.SelectboxColumn(
"Select Person",
help="Select Person",
width="medium",
options= ,
required=True,
)
},
num_rows='dynamic',
)
Thanks in advance!