Browse Source

Fix #138: IE8 search data and remove method error.

zhixin 11 years ago
parent
commit
73e13690bb
1 changed files with 5 additions and 3 deletions
  1. 5 3
      src/bootstrap-table.js

+ 5 - 3
src/bootstrap-table.js

@@ -549,7 +549,9 @@
             $search = this.$toolbar.find('.search input');
             $search.off('keyup').on('keyup', function (event) {
                 clearTimeout(timeoutId); // doesn't matter if it's 0
-                timeoutId = setTimeout($.proxy(that.onSearch, that), 500, event); // 500ms
+                timeoutId = setTimeout(function () {
+                    that.onSearch(event);
+                }, 500); // 500ms
             });
         }
     };
@@ -575,7 +577,7 @@
 
             this.data = s ? $.grep(this.options.data, function (item) {
                 for (var key in item) {
-                    if (that.header.fields.indexOf(key) !== -1 &&
+                    if ($.inArray(key, that.header.fields) !== -1 &&
                         (typeof item[key] === 'string' ||
                         typeof item[key] === 'number') &&
                         (item[key] + '').toLowerCase().indexOf(s) !== -1) {
@@ -1191,7 +1193,7 @@
             if (!row.hasOwnProperty(params.field)) {
                 return;
             }
-            if (params.values.indexOf(row[params.field]) !== -1) {
+            if ($.inArray(row[params.field], params.values) !== -1) {
                 this.options.data.splice(i, 1);
             }
         }