I'm trying to select some rows depending on if i select or deselect a row, if i select a row, the rows with the index lower than the index of the selected row, will be slected too. The problem that i have is that each time the setSelected(true) or setSelected(false) is executed, the onRowSelected event is triggered again, and it becomes an infinite loop.
this.gridOptions.onRowSelected = function(event) {
var rowIndexSelected = event.rowIndex;
if (event.node.selected) {
vm.gridOptionsSuiviPrestataire.api.forEachNode(function(rowNode, index) {
if (index < rowIndexSelected) {
rowNode.setSelected(true);
}
});
} else {
vm.gridOptionsSuiviPrestataire.api.forEachNode(function(rowNode, index) {
if (index > rowIndexSelected) {
rowNode.setSelected(true);
}
});
}
};
Is there a way to do this without triggering the onRowSelected event listener or to use some flag to prevent executing the code inside of the method ?