I am selecting a row on aggrid table which is leading to the table vanishing and I have to rerun the app. This is happening everytime I select even one row.
My code:
gb = GridOptionsBuilder.from_dataframe(final_df)
gb.configure_default_column(enablePivot=True, enableValue=True, enableRowGroup=True)
gb.configure_selection(selection_mode="multiple", use_checkbox=True, pre_selected_rows=st.session_state.selected_rows)
gb.configure_column("remark", header_name="Remark", editable=True)
gb.configure_column("Correct Label", header_name="Correct Label", editable=True, cellEditor='agSelectCellEditor', cellEditorParams={'values': dropdownopt }) #True false
cell_renderer = JsCode("""
function(params) {return `<a href=${params.value} target="_blank">${params.value}</a>`}
""")
gb.configure_column("url", headerName="url",cellRenderer=cell_renderer)
# gb.configure_column("remark", editable=True)
gb.configure_side_bar()
gridoptions = gb.build()
response = AgGrid(
final_df,
height=200,
gridOptions=gridoptions,
# enable_enterprise_modules=True,
update_mode=GridUpdateMode.SELECTION_CHANGED,
data_return_mode=DataReturnMode.FILTERED_AND_SORTED,
fit_columns_on_grid_load=True,
header_checkbox_selection_filtered_only=True,
use_checkbox=True,
allow_unsafe_jscode=True,
theme='streamlit',
reload_data=False)
selected_row = response['selected_rows']
st.write("Selected rows: ", selected_row)
I am unable to persist the selection which vanishes once I select the row and the table also goes away.
Please help.