I would not rewrite the custom formatter -- but override it (or make a new one)! That way, when a new version of jQgrid comes out, you don t overwrite your custom wrapper.
For example, my users don t want to see the value if it is 0, so I do this:
$.fn.fmatter.currency = function (cellval, opts) {
if (cellval == 0) {
return ;
}
var op = $.extend({},opts.currency);
if(!isUndefined(opts.colModel.formatoptions)) {
op = $.extend({},op,opts.colModel.formatoptions);
}
if(isEmpty(cellval)) {
return op.defaultValue;
}
return $.fmatter.util.NumberFormat(cellval,op);
};
But I could also call it:
$.fn.fmatter.currencyNoZero
In your case, I would do this:
$.fn.fmatter.currency = function (cellval, opts) {
if (cellval == null) {
return ;
}
var op = $.extend({},opts.currency);
if(!isUndefined(opts.colModel.formatoptions)) {
op = $.extend({},op,opts.colModel.formatoptions);
}
if(isEmpty(cellval)) {
return op.defaultValue;
}
return $.fmatter.util.NumberFormat(cellval,op);
};