Nipuna
Nipuna

Reputation: 7006

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

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.

Upvotes: 6

Views: 9319

Answers (2)

user2460382
user2460382

Reputation: 1

This option multiboxonly: true still make checkbox checked on row selection

Upvotes: 0

Chad Ferguson
Chad Ferguson

Reputation: 3091

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
     . . .
});

Upvotes: 3

Related Questions