gpt4 book ai didi

jqgrid - 在 jqGrid 中创建复选框

转载 作者:行者123 更新时间:2023-12-04 17:11:10 32 4
gpt4 key购买 nike

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

最佳答案

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

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

关于jqgrid - 在 jqGrid 中创建复选框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12915263/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com