Browse Source

Merge pull request #4381 from wenzhixin/fix/4378

Filter out null and undefined
文翼 6 years ago
parent
commit
0283cdaf47
1 changed files with 3 additions and 1 deletions
  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 ($.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) {
                 if (thisColumn.filterStrictSearch) {
                   itemIsExpected.push(value.toString().toLowerCase() === fval.toString().toLowerCase())
                   itemIsExpected.push(value.toString().toLowerCase() === fval.toString().toLowerCase())
                 } else if (thisColumn.filterStartsWithSearch) {
                 } else if (thisColumn.filterStartsWithSearch) {