ag-grid provides a way to get selected rows using api.getSelectedRows()
function. And provides a way to set all rows using api.setRowData([])
function.
I was wondering the same thing and found it annoying that you cannot simply get all rows. In my case I needed to flip a flag on all rows, where the indicator is set outside the component containing the grid, so I did the following. This is in TypeScript for a React app.
gridApi!.selectAll();
const rows = gridApi!.getSelectedRows();
rows.forEach(row => {
row.coverageAction = this.props.isIndicatorChecked;
});
gridApi!.setRowData(rows);