jqgrid中的多个复选框列.处理onchange事件

Ann*_*Ann 1 javascript checkbox jquery jqgrid

我正在创建一个带有可编辑字段的jqgrid.我在jqgrid中有两个复选框列,一个来自multiselect:true(获取唯一的rowId),其他列在列模型中创建.

我想处理我的列模型中复选框的onchange(选中/未选中)事件,与其他复选框列无关(multiselect:true).任何帮助赞赏.以下是代码段.

[{name : "userRole", label: 'OV', width: 40, editable:true, edittype:'checkbox',formatter: 'checkbox', editoptions: {value:"True:False"},
 formatoptions: { disabled: false},frozen:true}]
multiselect: true,
 onSelectRow: function(rowid){ 
             jQuery(this).editRow(rowid, true);
            }
Run Code Online (Sandbox Code Playgroud)

Ole*_*leg 6

你可以使用beforeSelectRow回调.该演示演示了该方法.它使用以下代码

beforeSelectRow: function (rowid, e) {
    var $target = $(e.target), $td = $target.closest("td"),
        iCol = $.jgrid.getCellIndex($td[0]),
        colModel = $(this).jqGrid("getGridParam", "colModel");
    if (iCol >= 0 && $target.is(":checkbox")) {
        alert("checkbox is " +
              ($target.is(":checked")? "checked" : "unchecked") +
              " in the column \"" + colModel[iCol].name +
              "\" in the row with rowid=\"" + rowid + "\"");
    }
    return true;
}
Run Code Online (Sandbox Code Playgroud)