Hello! I’m having an issue with the AgGrid dynamic table. I want users to be able to select multiple rows of a data frame, but when clicking on selectbox, the table reloads and clears the selection. The issue happens from time to time - sometimes I’m able to select 3-4 rows and then after selecting another one, the whole table clears the previous selection. I tried it on the latest versions of the streamlit and aggrid as well as on previous versions. I know that I can change the update mode to manual and it solves the problem but I don’t really want users to click that update button and wondering if there is an easy way to fix this.
Did someone encounter such issue?
Thanks in advance!
Here’s my code:
# define path to excel data source path = os.path.dirname(__file__) my_file = path+'/data.xlsx' # function to load excel data to pandas dataframe @st.cache(allow_output_mutation=True) def load_data(): df = pd.read_excel(my_file) return df #load source data data = load_data() gb = GridOptionsBuilder.from_dataframe(data) gb.configure_selection(selection_mode="multiple", use_checkbox=True) gridOptions = gb.build() response = AgGrid( data, gridOptions=gridOptions, enable_enterprise_modules=False, height=600, update_mode=GridUpdateMode.SELECTION_CHANGED, data_return_mode=DataReturnMode.FILTERED_AND_SORTED, fit_columns_on_grid_load=False ) response_df = pd.DataFrame(response["selected_rows"]) st.dataframe(response_df)