Search code examples
checkboxjqgriddouble-click

JqGrid prevent checkboxes from double clic event


I'm using a JqGrid with multiselect : true and i'm using double clic event to launch an edit function.

ondblClickRow: function (rowid) {
                var rowData = $(this).getRowData(rowid);
                document.location.href = "../record/" + rowData['id']
            },

But when it comes to select multiple rows, if you select or deselect the checkbox too quickly it launches the edit function (which I do not want).

How can I prevent the dblclick event on the checkboxes and allow it anywhere else on the rest of the row ?


Solution

  • You can do it this way:

    ondblClickRow: function(rowid, iRow, iCol, e) {
       if ($(e.target).is("input")) {
           return;
       }
       var rowData = $(this).getRowData(rowid);
       document.location.href = "../record/" + rowData['id']},