使用编辑选项时,未在 jqGrid 的编辑形式中设置复选框的值

Value of checkbox not set in edit form of jqGrid when using editoptions

我注意到,如果我将 editoptions 参数设置为带有 edittype:'checkbox' 的列,则不会在编辑表单中设置复选框的值。

即使使用空对象作为编辑选项,您也可以重现它。

...
colModel: [
    {name: 'checked', index: 'checked', editable: true, edittype: 'checkbox', formatter: 'checkbox', editoptions:{}}
]
...

尝试 select 第一行并在此 demo

中进行编辑

这似乎是 jqgrid 中的一个错误,但我还没有找到任何修复或解决方法。有人知道吗?

在我的具体情况下,我使用编辑选项为输入元素填充 dataEvents,因此我无法删除它。

删除这部分", editoptions:{}"

改用这个: col模型:[ {名称:'checked',索引:'checked',可编辑:真,编辑类型:'checkbox',格式化程序:'checkbox'} ]

您的演示使用非常非常旧(6 岁)的 jqGrid 4.1.2 版。这个版本已经死了很长时间了。我强烈建议您升级到当前版本 free jqGrid - 免费的 jqGrid 4.14.0。它是我从 2014 年底开始开发的 jqGrid 的分支。免费的 jqGrid 要求至少使用 jQuery 1.7.2,但建议使用 jQuery 3.2.1 或 1.12.4,如果你需要旧网络浏览器的支持。

我建议您另外查看 the article some base new features existing in free jqGrid fork. For example, one can use Font Awesome icons to improve the visibility of the grid. Additional information can be found in the wiki 和以前发布版本的自述文件。