Just want to know whether we can distinguish between all row selection and individual row selection in ag-grid(via header checkbox selection). Is there a method or property associated with ag-grid to tell this difference?
2 Answers
Yes you can. The ag-grid api offers some useful methods:
this.api.getSelectedRows() will get you all the selected rows.
this.api.getDisplayedRowCount() will get you all the rows displayed.
If these 2 equal each other, then the user has selected all the rows.
Ps. the api is a of type GridApi, which is initialised from the gridReady event exposed by ag-grid.
Comments
Just listen to selectionChanged event at grid level to apply some action per selection changed by column header checkbox
1 Comment
Ozan Mudul
can you prevent selection for some rows?