Ag-Grid

Firstly Happy New Year to all the members of Streamlit Community. How to add “Select All” option in Ag-Grid? I will be highly obliged if you give me a solution.

Please someone help me. Or if there are any resources please forward it to me.

from st_aggrid.grid_options_builder import GridOptionsBuilder
import pandas as pd

df=pd.DataFrame()
gb = GridOptionsBuilder.from_dataframe(df)
GridOptions=gb.build() 
GridOptions[“columnDefs”][0][“checkboxSelection”]=True
GridOptions[“columnDefs”][0][“headerCheckboxSelection”]=True

Thanks @imClumsyPanda . It worked. I have one more question. Can we calculate some value based on the selection and showed it in the container?

You mean in aggrid table or in st.container? We can use result[“selected-rows”] to do calculations

I mean in aggrid table.

@imClumsyPanda basically I calculate a value based on the selection and showed it in the container or aggrid table. I tried with columns but it didn’t work. Can you give me a solution so that I can display a value on the container or aggrid table based on the selection?