Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JqGrid - Prevent checkbox check event on row click and keep row highlight enabled

Tags:

jquery

jqgrid

I have a jqgrid with multiselect enabled. But I don't want to check the checkbox when I click on the row.

Using the code snippet

$("#yourGrid").jqGrid("setGridParam", {
    beforeSelectRow: function(rowId, e) {
       return $(e.target).is("input:checkbox");
    }
});

from this post I was able to refrain from selecting the checkbox but now I can't highlight a particular row. How can I enable highlighting of a row keeping multiselect on row click disabled.

like image 531
Nipuna Avatar asked Jul 17 '12 09:07

Nipuna


1 Answers

There is a property on the grid that should do this for you, according to the API.

multiboxonly

This option works only when the multiselect option is set to true. When multiselect is set to true, clicking anywhere on a row selects that row; when multiboxonly is also set to true, the multiselection is done only when the checkbox is clicked (Yahoo style). Clicking in any other row (suppose the checkbox is not clicked) deselects all rows and selects the current row.

With this you shouldn't need your beforeSelectRow function:

jQuery("#grid").jqGrid({
     . . .
     multiselect: true,
     multiboxonly: true
     . . .
});
like image 131
DisplayName Avatar answered Nov 15 '22 00:11

DisplayName