Selecting a row on aggrid streamlit table vanishes the table itself

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.

@Shawn_Pereira have you come across this issue?

@PablocFonseca is this a bug?

FYI- I am using the latest version of streamlit-aggrid

Yes @yashsri8, I am writing an application that has 5 different aggrid invocations at different places. Only at 1 place, for some inexplicable reason, every object click seems to trigger a grid refresh.

Cheers

Thanks a lot for your reply. Can you share with me an approach or code I can play around with?

Haven’t figured it out yet…

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.