如何在“复选框"上切换复选框仅列,因此行选择不要切换复选框 [英] How to have checkbox be toggled on "checkbox" column only, so row select don't toggle checkbox
问题描述
我在jqGrid设置中使用multiselect: true
选项.
I'm using multiselect: true
option on jqGrid setup.
我遇到的问题是,当我单击任何行时,复选框会被切换.仅在单击复选框"列时,如何将复选框的切换限制为复选框"列.我不希望在单击第3列,第5列等时选中/取消选中该复选框.
The issue I'm having is when I click on any row, the checkbox get toggled. How do I limit the toggling of checkbox to "checkbox" column only when clicking on that "checkbox" column. I don't want the checkbox to be checked/unchecked when I click on 3rd column, 5th column, etc.
有可能吗?
推荐答案
回调beforeSelectRow
允许定义用于选择行的特定规则.它应该返回false以防止选择. multiselect列中的复选框具有CSS类"cbox"
.因此,回调
The callback beforeSelectRow
allows to define specific rules for selection the row. It should return false to prevent the selection. The checkboxes from multiselect column have CSS class "cbox"
. Thus the callback
beforeSelectRow: function (rowid, e) {
return $(e.target).hasClass("cbox");
}
应该解决问题.
这篇关于如何在“复选框"上切换复选框仅列,因此行选择不要切换复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!