I am Amanda Walker, one of the Core team engineers, and I am the engineering lead for the Session State project. I’m very happy to finally make this available to you all, and I’m excited to see what this will enable people to make.
Really fantastic, and tying the “default” widget states into the same mechanism is also a brilliant idea - should allow for resetting the whole app etc!
I started using version 0.84.0 today, and st.session_state is working great so far!
Unfortunately, though, I seem to have encountered an incompatibility with the st_aggrid component. If I try to apply a filter in the interactive grid, I get an error: "TypeError: string indices must be integers". Rolling streamlit back to version 0.83 solved the issue.
I used the following function to generate the datatable. Thanks in advance!
from st_aggrid import AgGrid, GridOptionsBuilder, DataReturnMode, GridUpdateMode
def interactive_datatable(df):
'''
Use st_aggrid to show well table in GUI with interactive sorting and filtering options.
df: input dataframe
Returns: dataframe of AgGrid output (including filtering via GUI)
'''
#set up aggrid display/interactivity options
gb = GridOptionsBuilder.from_dataframe(df)
gb.configure_default_column(groupable=True, value=True, enableRowGroup=True, aggFunc='sum', editable=False)
gridOptions = gb.build()
#set up data return/update modes
return_mode_value = DataReturnMode.__members__['FILTERED_AND_SORTED']
update_mode_value = GridUpdateMode.__members__['FILTERING_CHANGED']
data_return_mode = return_mode_value
grid_data = AgGrid(df,
gridOptions=gridOptions,
width='100%',
data_return_mode=return_mode_value,
update_mode=update_mode_value)
grid_data_df = pd.DataFrame(grid_data['data'])
return grid_data_df
Thank you!
The session state implementation works wonderful once I did understand how to use it. For me this was the number one thing missing to make streamlit much more useful!