Posted 31 March 2024, 9:26 pm EST
Hi Teun,
This is the expected behavior that the selectionChanged event is triggered two times when selector checkboxes are used in the cells panel instead of the rowHeaders panel. The reason behind this behavior is that when you click on the checkbox, the whole row is selected due to which the selectionChanged event is triggered, and at the same time the cell that contains the checkbox becomes the active cell, triggering the selectionChanged event a second time.
To avoid this situation, you can use the column in rowHeaders panel of the grid, to show the selector checkboxes, you can also insert more columns in the row headers panel if needed, by referring to the following sample - https://developer.mescius.com/wijmo/demos/Grid/Columns/Collections/angular.
And if you are using the selectionChanged event, just to get the information about the rows selected using the checkboxes, then you can handle the ‘itemChecked’ event of FlexGrid Selector for this purpose, instead of the ‘selectionChanged’ event, and get the selected rows like this -
grid.rows.filter((r) => r.isSelected)
To get the exact information about the checked/unchecked state of the selector checkboxes, you can handle the ‘click’ event on the flexGrid’s host element, and use the hitTest method to evaluate the click information and get the right information about row selection. Please refer to the following sample demonstrating the same - https://stackblitz.com/edit/angular-ivy-p4zhdw?file=src%2Fapp%2Fapp.component.ts
In case, you face any issues, please let us know.
Regards