浏览代码

filter out null and undefined

Dustin Utecht 6 年之前
父节点
当前提交
3ba614e6b3
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      src/extensions/filter-control/bootstrap-table-filter-control.js

+ 3 - 1
src/extensions/filter-control/bootstrap-table-filter-control.js

@@ -715,7 +715,9 @@ $.BootstrapTable = class extends $.BootstrapTable {
             }
 
             if ($.inArray(key, that.header.fields) !== -1) {
-              if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
+              if (value === undefined || value === null) {
+                itemIsExpected.push(false)
+              } else if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
                 if (thisColumn.filterStrictSearch) {
                   itemIsExpected.push(value.toString().toLowerCase() === fval.toString().toLowerCase())
                 } else if (thisColumn.filterStartsWithSearch) {