hi, my friends.
I’m using aggrid in my streamlit application, but there is a issue make me confused.
I defined a function to build aggrid, use streamlit input wedgets to display the selected data. when I change the input wedgets value, aggrid always reload !
I try to use ‘st.cache’ and ‘st.experimental_memo’ before the function, but it doesn’t work and the aggrid doesn’t show up.
is there any solution?
@st.cache(suppress_st_warning=True)
def aggrid_builder(df: pd.DataFrame) -> dict:
builder = GridOptionsBuilder.from_dataframe(df)
builder.configure_pagination(enabled=True, paginationAutoPageSize=False, paginationPageSize=15)
builder.configure_selection(selection_mode='single', use_checkbox=True)
go = builder.build()
response = AgGrid(
df,
gridOptions=go,
enable_enterprise_modules=False,
update_mode=GridUpdateMode.MODEL_CHANGED,
data_return_mode=DataReturnMode.FILTERED_AND_SORTED,
fit_columns_on_grid_load=False
)
return response['selected_rows']
def edit_form(response: dict):
# some input wedgets to display "response" and change value