Aggrid - Unselect all Rows

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.

1 Like

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.

1 Like

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.

  1. Pre-selection:
    a. Find out the number of dataframe rows that feed into your aggrid (using a command such as totrows = df.shape[0])
    b. Configure your aggrid initially with
    gb.configure_selection(‘multiple’, pre_selected_rows=[1, totrows])

  2. I suppose you could also use the aggrid API, which I have not attempted at all (because I never had the need to)



Hi all,

Has anyone successfully used the aggrid API’s deselectAll() function for the Streamlit-aggrid component? In case you can share an example :slight_smile: Thanks a lot.