jquery - JqG​​rid - 防止行单击时的复选框检查事件并保持行突出显示启用

标签 jquery jqgrid

我有一个启用了多选的 jqgrid。但我不想在单击该行时选中该复选框。

使用代码片段

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

来自 this post我能够避免选择该复选框,但现在我无法突出显示特定行。如何启用行的突出显示,同时禁用行单击时的多选。

最佳答案

根据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.

有了这个,您就不需要 beforeSelectRow 函数:

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

关于jquery - JqG​​rid - 防止行单击时的复选框检查事件并保持行突出显示启用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11519537/

相关文章:

jQuery .on ('click' ) 与 .click() 和 .delegate ('click' )

javascript - IE7无法加载jqgrid

jquery - 在jqgrid中编辑或添加行后如何将数据保存到数据库

javascript - 刷新 jqGrid 不会保存启用无限滚动的当前页面位置

jquery - 使一个 div 滚动到另一个 div 的前面?

asp.net - 对一个页面执行一次脚本

javascript - 时间延迟重定向?

JQGrid、Telerik、DataTables 等哪个好?

javascript - jqGrid setRowData 失败

javascript - 当我从另一个列表中选择时,选项列表未加载