在jqGrid中创建复选框 [英] Create Checkbox in jqGrid

查看:100
本文介绍了在jqGrid中创建复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在jqgrid列中创建复选框,并使用以下代码

I am trying to create the checkbox inside the jqgrid columns and using the below code

{ 
   name: 'CanDo', width: 50, index: 'CanDo', 
   edittype: 'checkbox', editoptions: { value: "True:False" }, 
   formatter: "checkbox", formatoptions: { disabled: true} 
}

Json对象返回"True"或"False"

Json object is returning either "True" or "False"

但是复选框本身不是在网格中创建的.会是什么问题?

But the check box itself is not created in grid. What would be the issue?

请帮助.

使用jquery.jqGrid.BasicOnly.min.js 4.1.2

Using 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"]}]}

推荐答案

我相信您缺少editable:true选项.试试这个:

I believe you are missing the editable:true option. Try this:

{ 
 name: 'CanDo', width: 50, index: 'CanDo', 
 editable: true,
 edittype: 'checkbox', editoptions: { value: "True:False" }, 
 formatter: "checkbox", formatoptions: { disabled: true} 
}

这篇关于在jqGrid中创建复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆