I don't think that you need to set any offval
attribute inside of your custom checkbox formatter. jqGrid set the attribute itself if one uses edittype: "checkbox"
(see the part of code). So it seems to me that you don't need to set offval
neither in your custom formatter nor in custom editing control if you create it too.
By the way in the time when I posted the code of formatter: "clickableCheckbox" I had the same question as you. I didn't understood the mean of offval
and I just included offval="no"
in the code. :-). I don't think that it has any sense, but to be sure one have to test all of cause.
If you write your custom formatter which you use multiple times I would recommend you to use
(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.