jqGrid checkbox formatter will be checked when cval is 'N' #379

Closed
kccarter opened this Issue Nov 6, 2012 · 1 comment

Projects

None yet

2 participants

@kccarter
Contributor
kccarter commented Nov 6, 2012

Current code block for the checkbox formatter

$.fn.fmatter.checkbox =function(cval, opts) {
        var op = $.extend({},opts.checkbox), ds;
        if(opts.colModel !== undefined && !$.fmatter.isUndefined(opts.colModel.formatoptions)) {
            op = $.extend({},op,opts.colModel.formatoptions);
        }
        if(op.disabled===true) {ds = "disabled=\"disabled\"";} else {ds="";}
        if($.fmatter.isEmpty(cval) || $.fmatter.isUndefined(cval) ) {cval = $.fn.fmatter.defaultFormat(cval,op);}
        cval=cval+"";cval=cval.toLowerCase();
        var bchk = cval.search(/(false|0|no|off)/i)<0 ? " checked='checked' " : "";
        return "<input type=\"checkbox\" " + bchk  + " value=\""+ cval+"\" offval=\"no\" "+ds+ "/>";
    };

code block with resolution

$.fn.fmatter.checkbox =function(cval, opts) {
        var op = $.extend({},opts.checkbox), ds;
        if(opts.colModel !== undefined && !$.fmatter.isUndefined(opts.colModel.formatoptions)) {
            op = $.extend({},op,opts.colModel.formatoptions);
        }
        if(op.disabled===true) {ds = "disabled=\"disabled\"";} else {ds="";}
        if($.fmatter.isEmpty(cval) || $.fmatter.isUndefined(cval) ) {cval = $.fn.fmatter.defaultFormat(cval,op);}
        cval=cval+"";cval=cval.toLowerCase();
        var bchk = cval.search(/(false|0|no|n|off)/i)<0 ? " checked='checked' " : "";
        return "<input type=\"checkbox\" " + bchk  + " value=\""+ cval+"\" offval=\"no\" "+ds+ "/>";
    };
@kccarter kccarter added a commit to kccarter/jqGrid that referenced this issue Nov 6, 2012
@kccarter kccarter Update js/jquery.fmatter.js
resolves issue #379
b398cf3
Owner

Already merged

@tonytomov tonytomov closed this Mar 28, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment