浏览代码

Merge pull request #3077 from jvdmr/timeout-per-column

keep timeout per column, not globally
文翼 8 年之前
父节点
当前提交
4e5fe1fd69
共有 1 个文件被更改,包括 7 次插入8 次删除
  1. 7 8
      src/extensions/filter-control/bootstrap-table-filter-control.js

+ 7 - 8
src/extensions/filter-control/bootstrap-table-filter-control.js

@@ -231,8 +231,7 @@
     var createControls = function (that, header) {
         var addedFilterControl = false,
             isVisible,
-            html,
-            timeoutId = 0;
+            html;
 
         $.each(that.columns, function (i, column) {
             isVisible = 'hidden';
@@ -319,8 +318,8 @@
                     return;
                 }
 
-                clearTimeout(timeoutId);
-                timeoutId = setTimeout(function () {
+                clearTimeout(event.currentTarget.timeoutId || 0);
+                event.currentTarget.timeoutId = setTimeout(function () {
                     that.onColumnSearch(event);
                 }, that.options.searchTimeOut);
             });
@@ -334,8 +333,8 @@
                     return;
                 }
                 
-                clearTimeout(timeoutId);
-                timeoutId = setTimeout(function () {
+                clearTimeout(event.currentTarget.timeoutId || 0);
+                event.currentTarget.timeoutId = setTimeout(function () {
                     that.onColumnSearch(event);
                 }, that.options.searchTimeOut);
             });
@@ -352,8 +351,8 @@
                     var newValue = $input.val();
 
                     if (newValue === "") {
-                        clearTimeout(timeoutId);
-                        timeoutId = setTimeout(function () {
+                        clearTimeout(event.currentTarget.timeoutId || 0);
+                        event.currentTarget.timeoutId = setTimeout(function () {
                             that.onColumnSearch(event);
                         }, that.options.searchTimeOut);
                     }