6

我正在尝试在 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"]}]}
4

1 回答 1

12

我相信你错过了这个editable:true选项。试试这个:

{ 
 name: 'CanDo', width: 50, index: 'CanDo', 
 editable: true,
 edittype: 'checkbox', editoptions: { value: "True:False" }, 
 formatter: "checkbox", formatoptions: { disabled: true} 
}
于 2012-10-16T13:43:33.963 回答