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

2

6

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.

Soapwort answered 17/7, 2012 at 9:21 Comment(0)
S
3

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
     . . .
});
Spode answered 17/7, 2012 at 13:8 Comment(0)
P
0

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

Parlando answered 28/11, 2022 at 12:15 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Ultima

© 2022 - 2024 — McMap. All rights reserved.