Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2585
How to tell if igGrid rowselector when column clicked is selected vs deselected
posted

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;

Parents
No Data
Reply
  • 1320
    Offline posted

    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

Children