Javascript 当multiselect选项设置为true时,为复选框列添加自定义格式设置程序

Javascript 当multiselect选项设置为true时,为复选框列添加自定义格式设置程序,javascript,jquery,jqgrid,Javascript,Jquery,Jqgrid,我使用jqgrid作为具有multiselect:true属性的网格。我想根据某些行值删除某些行的复选框(禁用/不允许检查)。我想在复选框模型上添加格式化程序,以删除该列上的复选框 我试图在预处理之前访问colModel inside,但我还没有看到jqgrid自动添加的列名“cb”。因此,我不能在colmodel中为“cb”注入格式化程序 jqGrid({ multiselect: true, beforeSelectRow: function() { //called wh

我使用jqgrid作为具有multiselect:true属性的网格。我想根据某些行值删除某些行的复选框(禁用/不允许检查)。我想在复选框模型上添加格式化程序,以删除该列上的复选框

我试图在预处理之前访问colModel inside,但我还没有看到jqgrid自动添加的列名“cb”。因此,我不能在colmodel中为“cb”注入格式化程序

jqGrid({
  multiselect: true,
  beforeSelectRow: function() {
     //called when tried to select one row.
     //its not called when selectAll is called.
  },
  onSelectAll: function(rowids, status) {
     //gets selected row ids when status is true
  }
})
1) 我想根据行值操作复选框的选择

2) 如果带列的行isApplicable=false,则复选框不应(可见/可选择)


jgrid版本:5.3.0

在问题文本中始终包含jqGrid版本,这一点很重要。了解jqGrid(商业版或旧版jqGrid)的fork也很重要。我已经尝试了rowattr。但真正的问题在于selectAll。即使我跳过复选框。selectAll默认情况下将返回所有可见行。它不会跳过不适用的复选框。始终返回所有记录。$('gridid')。jqGrid('getGridParam','selarrrow')@MayurPatil:您在问题的末尾添加了使用商业Guriddo jqGrid 5.3.0。它不支持
hasMultiselectCheckBox
jqgskipselect
。因此您在
selectAll
中遇到问题,因为使用不支持
jqgskipselect
类的fork。我写道,您可以使用disabled class而不是jqgskipselect(
ui-state-disabled
disabled
)取决于您使用的CSS框架。
hasMultiselectCheckBox: : function (options) {
    // options is object like below
    // { rowid: rowid, iRow: irow, iCol: pos, data: item, checked: checked };
    // one can use options.data to examine the data of the current row

    return options.data != null && options.data.isApplicable;
}
beforeSelectRow: function (rowid) {
    var item = $(this).jqGrid("getLocalRow", rowid);

    if (item != null && !item.isApplicable) {
        return true;
    }
    return false;
},
rowattr: function (item) {
    if (!item.isApplicable) {
        return { "class": "jqgskipselect" };
    }
},