easyui datagrid datagrid-filter bug

问题描述:空字符串、数字过滤 过滤异常

修改js源码:

 $.fn.datagrid.defaults.operators = {
        nofilter: {
            text: 'No Filter'
        },
        contains: {
            text: 'Contains',
            isMatch: function (source, value) {
                return source.toString().toLowerCase().indexOf(value.toLowerCase()) >= 0;// modfy by 253
            }
        },

........

 

   function isMatch(row) {
            var rules = opts.filterRules;
            for (var i = 0; i < rules.length; i++) {
                var rule = rules[i];
                var source = row[rule.field];
                if (source || source == "" || typeof ( source)=="number ") {// modfy by 253
                    var op = opts.operators[rule.op];
                    if (!op.isMatch(source, rule.value)) {
                        return false;
                    }
                }
            }
            return true;
        }

....

 

 

摘自:http://my.oschina.net/gofan/blog/208535

posted @ 2015-08-26 14:14  pengbg  阅读(1441)  评论(0编辑  收藏  举报