I have a grid with row selectors and I'm using the gridRowSelectorsRowSelectorClicked event for when the user clicks on the column and not the checkbox of the row selector. Is there a way in this event to see if the row is being selected or unselected?
Ideally i'd like the information below that we can get in the gridRowSelectorsCheckBoxStateChanging event.
checkBoxState = ui.newState; isHeader = ui.isHeader;
Hello Tammy,
After investigating this further, I determined that the state of the clicked row could be checked in a method bound to the rowSelectorClicked event. In this method it could be determined whether a row is selected by looping through all selected rows in the grid:
rowSelectorClicked: function(evt, ui){
var rowIsSelected = false;
$("#gridRowSelectors").igGridSelection("selectedRows").forEach(element => {
if(ui.rowIndex == element.index){
rowIsSelected = true;
}
});
console.log(rowIsSelected);
},
Below I am attaching a sample, demonstrating the described behavior. Please test it on your side and let me know if you need any further information regarding this matter.
Regards, Monika Kirkova, Infragistics
igGridRowSelectors.zip
Thanks that will work. I was hoping for a more direct approach to avoid the looping.
I am glad my suggestion helped you achieve your requirement.
Additionally, since the row state is not passed in the event arguments of rowSelectorClicked event, a check has to be performed in order to determine it.
Thank you for using Infragistics components.