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
100
All rows are deselected when clicking on any row
posted

It appears that when using an igGrid with multipleSelection set to true and enableCheckBoxes set to true that the only way to select the row is to click directly inside the checkboxes for the row.  If the user slightly misses a checkbox or clicks anywhere else on the row, all rows are deselected and the row clicked on is selected instead.  What's the best way to prevent this default behavior?  I'm not exactly sure what the best way to be more forgiving when a user clicks on a row instead of a checkbox, but I'm leaning towards the best solution being that clicking anywhere on a row will toggle the selection and leave all of the other selected rows alone.

  • 17559
    posted

    Hello James,

     

    I have been looking into your requirements and I could suggest you handle the rowSelectionChanging event of the Selection feature like this:

    {

        name: "Selection",

        mode: "row",

        rowSelectionChanging: function (evt, ui) {

            if ($(ui.row.element).find("td.ui-iggrid-selectedcell").length === 0)

                setTimeout(function () {

                    $("#grid1").igGridSelection("selectRow", ui.row.index);

                }, 100)

            else

                setTimeout(function () {

                    $("#grid1").igGridSelection("deselectRow", ui.row.index);

                }, 100)

     

                return false;

        },

        cellSelectionChanging: function (evt, ui) {

            return false;

        },

        multipleSelection: true

    },

     

    Please let me know if this helps.

    RowSelectorsWithCheckboxes - Copy.zip