我认为您不需要offval
在自定义复选框格式化程序中设置任何属性。如果使用,jqGrid 会自行设置属性edittype: "checkbox"
(参见代码部分)。因此,在我看来,如果您也创建了自定义格式化程序,也不需要在自定义编辑控件中进行设置offval
。
顺便说一句,在我发布格式化程序代码的时候:“clickableCheckbox”我和你有同样的问题。我不明白的意思,offval
我只是包含offval="no"
在代码中。:-)。我认为这没有任何意义,但要确保必须测试所有原因。
如果您编写多次使用的自定义格式化程序,我建议您使用
(function ($) {
"use strict";
$.extend($.fn.fmatter, {
yourFormatterName: function (cellValue, options) {
....
}
});
$.extend($.fn.fmatter.yourFormatterName, {
unformat: function (cellValue, options, elem) {
...
}
});
}(jQuery));
as prototype of the formatter. In the way you will register new formatter "yourFormatterName" which you can use exactly like any other predefined formatters: you need just use formatter: "yourFormatterName"
instead of formatter: "checkbox"
in the column definition of the corresponding column. I find this way very practical.