Reusing the Ag grid instance for reloading

Hi Everyone,
I am doing following steps:

  1. Loading data from CSV to AGrid.
  2. Add a row to the CSV file.
  3. Read the updated CSV file and initialize the AGrid.
    When same instance of AGGrid is use to reload i get the error:
    self.sessiongrid.AgGrid(self.sessiondf,
    AttributeError: ‘dict’ object has no attribute ‘AgGrid’

Is there something wrong with the usage? Please suggest

Also if I create new Ag-Grid every csv update, Grid gets created in a different location. To avoid this i have to use st.experimental_rerun().

snippet:

def loadGrid(self):
        gridOptions = self.gb.build()
        with st.container():
            if(self.sessiongrid == None):
                self.sessiongrid = AgGrid(self.sessiondf,
                                gridOptions = gridOptions,
                                height=250,
                                update_mode=GridUpdateMode.SELECTION_CHANGED,
                                reload_data=True,
                                allow_unsafe_jscode=True)
            else:
                print('reusing the existing instance')
                print(self.sessiongrid)
                self.sessiongrid.AgGrid(self.sessiondf,
                                gridOptions = gridOptions,
                                height=250,
                                update_mode=GridUpdateMode.SELECTION_CHANGED,
                                reload_data=True,
                                allow_unsafe_jscode=True)
                                
        return self.sessiongrid

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