Hello, I would like to add a button in my Streamlit project to clear all the rows selected in an Aggrid Table with checkbox. Is there a way of doing it ? I tried various things (i.e. api.deselectAll()) but could not make it). Thanks for your help.
hi @Gegeh , you can add a checkbox to the column header during the grid configuration:
With this checkbox, you can de/select all rows.
Thank you very much for your prompt answer. Highly appreciated.
Hi Shawn, I’m appreciate your last post, very useful. May I ask if it possible to get the headerchecbox already selected when Streamlit app is launched.
Hi @Philippe_Franco , there are probably 2 ways to do this, both of which I have not tried out.
a. Find out the number of dataframe rows that feed into your aggrid (using a command such as totrows = df.shape)
b. Configure your aggrid initially with
gb.configure_selection(‘multiple’, pre_selected_rows=[1, totrows])
I suppose you could also use the aggrid API, which I have not attempted at all (because I never had the need to)
Has anyone successfully used the aggrid API’s
deselectAll() function for the Streamlit-aggrid component? In case you can share an example Thanks a lot.