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
335
igGrid row selection exclude specific column
posted

Hi Infragistics team,

I have a button in one of my grids and I would like to add the Selection and RowSelectors features.

However, I don't want to change selection when a user clicks this button. How do I cancel the rowSelectionChanging event only when clicking in this row or on the button?
Also acceptable would be a method to completely disable selection by clicking on the row, only using the checkbox.

Parents
No Data
Reply
  • 1320
    Offline posted

    Hello Ben,

    After investigating this further, I have determined that your requirement could be achieved by binding a method to the rowSelectionChanging event and checking which element from the row has been clicked. If this is the button the event would be canceled. This could be achieved as follows:

    {

              name: "Selection",

              rowSelectionChanging: function (evt, ui) {

                        if(ui.row.element.context.tagName == "BUTTON"){

                               return false;

                        }

              }

    },

    Additionally, if the row should be selected only by clicking on the checkbox, what I could suggest is defining a global variable and setting its value to true if the checkBoxStateChanging event is emitted. Afterwards in the rowSelectionChanging event the value of the variable could be checked and if is false, the event would be canceled.

    {

             name: "Selection",

             rowSelectionChanging: function (evt, ui) {

                        if(!isSelectorClicked){

                              return false;

                        }

                        isSelectorClicked = false;

             }

    },

    {

             name: "RowSelectors",

             enableCheckBoxes: true,

             checkBoxStateChanging: function(evt, ui){

                        isSelectorClicked = true;

             }

    },

    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

    igGridSelection.zip

Children