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!
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.