我正在尝试在jqgrid列中创建复选框并使用以下代码
{
name: 'CanDo', width: 50, index: 'CanDo',
edittype: 'checkbox', editoptions: { value: "True:False" },
formatter: "checkbox", formatoptions: { disabled: true}
}
Json对象返回“True”或“False”
但是复选框本身不是在网格中创建的。会是什么问题?
请帮忙。
编辑:使用jquery.jqGrid.BasicOnly.min.js 4.1.2
$("#pGrid").jqGrid({
datastr: '@Html.Raw(@Model.PList)',
datatype: 'jsonstring',
colNames: ['id','CanDo' ,'Name'],
colModel: [
{ name: 'id', hidden: true },
{ name: 'CanDo', width: 50, index: 'CanDo',editable: true, edittype: 'checkbox', editoptions: { value: "True:False" }, formatter: "checkbox", formatoptions: { disabled: true},
{ name: 'Name', width: 150 }
],
pager: '#pager',
rowNum: 100,
height: "200",
viewrecords: true,
caption: '<span class="spanH2">Test Process</span>'
});
JSON
{"total":1,"page":1,"records":2,
"rows": [
{"id":"1","cell":["1","True","Callback"]},
{"id":"8","cell":["8","False","Complaint"]}]}
答案 0 :(得分:10)
我相信你错过了editable:true
选项。试试这个:
{
name: 'CanDo', width: 50, index: 'CanDo',
editable: true,
edittype: 'checkbox', editoptions: { value: "True:False" },
formatter: "checkbox", formatoptions: { disabled: true}
}