我现在用的是MVC页面,上边有一个文本框输入相应的内容,下边有个datagrid去数据库查询相应的内容并显示,但是每条记录前边都要放上一个checkbox,插入一段我写的js,现在的问题是,页面上的checkbox一点击就报错: 'on' 为空或不是对象, 'off' 为空或不是对象
$('#subDataGrid').datagrid({
columns: [[
{ field: 'IsCheck', title: '是否选择', width: 100, editor: 'checkbox', formatter: boolFormat, align: 'center' },
{ field: 'Name_Product', title: '商品名称', width: 100 }
]],
idField: 'ID',
onClickRow: function (rowIndex) {
if (lastIndex != rowIndex) {
$('#subDataGrid').datagrid('endEdit', lastIndex);
$('#subDataGrid').datagrid('beginEdit', rowIndex);
}
lastIndex = rowIndex;
}
});
这个文档我也有一份,现在我又改成这样了,但又有问题了,只能单选,不能多选
{field: 'IsCheck', title: '是否选择', width: 100, formatter: boolFormat, checkbox: true, align: 'center',
editor: {
type: 'checkbox',
options: {
on: 1,
off: 0
}
}
},
singleSelect:false