JqGrid - Prevent checkbox check event on key press and keep row highlighting

I have jqgrid with multiselect enabled. But I do not want to check the checkbox when I click on the line.

Using a snippet of code

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

from this post I was able to refrain from selecting a check box, but now I can’t select a specific row. How to enable highlighting of a row that retains multi-selection when a row is disabled.

+6
source share
1 answer

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

 multiboxonly 

This option only works if the multiselect parameter is set to true. If multiselect is set to true, clicking anywhere in the line selects that line; when multiboxonly is also set to true, a multi-segment is only executed when a button is clicked (Yahoo style). Clicking on any other row (suppose the checkbox is not clicked) deselects all rows and selects the current row.

However, you do not need your beforeSelectRow function:

 jQuery("#grid").jqGrid({ . . . multiselect: true, multiboxonly: true . . . }); 
+3
source

Source: https://habr.com/ru/post/920667/


All Articles