Welcome to the React feedback portal. We’re happy you’re here! If you have feedback on how to improve the React, we’d love to hear it!>
Thanks for joining our community and helping improve Syncfusion products!
Hi,
I have a grid where I'm using a checkbox column to allow multiple selection and I want to be able to deselect a row that's already selected. I found odd behaviour making the selectRow api call with toggle for a row that's selected and the oddness varies depending on whether persistSelection is enabled or not.
If persistSelection is enabled and you have multiple rows selected then selectRow with toggle is only able to deselect the last of the selected rows. If you toggle an earlier selected row then nothing appears to happen.
I think that is down to this convoluted bit of code in the selection module (in particular the bolded bit):
isToggle = !isToggle ? isToggle :
!this.selectedRowIndexes.length ? false :
(this.selectedRowIndexes.length ? (this.isKeyAction && this.parent.isCheckBoxSelection ?
false : index === this.selectedRowIndexes[this.selectedRowIndexes.length - 1]) : false);
If persistSelection isn't enabled and you have multiple rows selected then selectRow toggling the last of the selected rows will deselect all the selected rows, whereas toggling a row before the last selected row will deselect all except that row.
I modified one of your documentation examples to help illustrate the unexpected behaviour:
https://stackblitz.com/edit/react-rv7ujl?file=App.js
So this starts with persistSelection enabled.