Browse Source

Fix #86: invisible column are still searchable.

zhixin 11 years ago
parent
commit
32fa3d3c57
1 changed files with 4 additions and 1 deletions
  1. 4 1
      src/bootstrap-table.js

+ 4 - 1
src/bootstrap-table.js

@@ -537,12 +537,15 @@
     };
 
     BootstrapTable.prototype.initSearch = function () {
+        var that = this;
+
         if (this.options.sidePagination !== 'server') {
             var s = this.searchText && this.searchText.toLowerCase();
 
             this.data = s ? $.grep(this.options.data, function (item) {
                 for (var key in item) {
-                    if ((typeof item[key] === 'string' ||
+                    if (that.header.fields.indexOf(key) !== -1 &&
+                        (typeof item[key] === 'string' ||
                         typeof item[key] === 'number') &&
                         (item[key] + '').toLowerCase().indexOf(s) !== -1) {
                         return true;