Hey everyone!
I’m currently using Ag-grid in my application. Every time you select a row or enter in an input, Ag-grid sends back data to Streamlit. This really eats away at the performance of the app.
Right now the user needs to select a row and in the Code column select A, B, C. Seems like it take 3-4 seconds for Ag-grid to process the selection and Code input.
I did try changing the update_mode=GridUpdateMode.SELECTION_CHANGED to .Manual, but I don’t like the save button you have to press. This is an extra step I don’t want to have.
After the user is done making their entries I have them click a button that saves the entries. Is there a way I can tie my button to work with the Ag-grid save button that appears when you set Update Mode to .Manual? So you only have to press one button?
Any other ideas to improve performance?
Thank you in advance.
dropdownlst = ('A','B', 'C')
gd = GridOptionsBuilder.from_dataframe(df)
gd.configure_pagination(enabled=True)
gd.configure_default_column(editable=True, groupable=True)
gd.configure_column('Code', editable=True, cellEditor='agSelectCellEditor', cellEditorParams={'values': dropdownlst })
gd.configure_selection(selection_mode = 'multiple',use_checkbox=True)
gridoptions = gd.build()
grid_table = AgGrid(df, columns_auto_size_mode=ColumnsAutoSizeMode.FIT_CONTENTS, gridOptions=gridoptions,
update_mode=GridUpdateMode.SELECTION_CHANGED | GridUpdateMode.VALUE_CHANGED,
height=500, width = 7000,
allow_unsafe_jscode=True,
enable_enterprise_modules = False,
)
sel_row = grid_table["selected_rows"]
df_selected = pd.DataFrame(sel_row)
if st.button('Update Code', key=1):
*saves user inputs*