0

I want to recalculate correct selected rows on filter change.

//server side select all

selectAllRows(e) {
 const firstRow = this.gridApi.getFirstDisplayedRow();
 const lastRow = this.gridApi.getLastDisplayedRow();

if(e.checked) {
  for (let idx = firstRow; idx <= lastRow; idx++) {
    this.gridApi.getDisplayedRowAtIndex(idx).setSelected(true);
    // this.gridApi.selectIndex(idx, true);
  }
  // this.gridApi.selectionController.selectAllRowNodes(true);
} else {
  this.gridOptions.api.deselectAll();
}
}
foram kantaria
  • 748
  • 6
  • 11

1 Answers1

0

Use api.selectAllFiltered() for selecting all filtered rows in the grid.

Check the documentation here - https://www.ag-grid.com/javascript-grid-selection/#grid-selection-api

abd995
  • 1,649
  • 6
  • 13