Browse Source

Add searchTimeOut

D0d0 11 years ago
parent
commit
7ee8961d2b
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/bootstrap-table.js

+ 3 - 1
src/bootstrap-table.js

@@ -165,6 +165,7 @@
         checkboxHeader: true,
         checkboxHeader: true,
         sortable: true,
         sortable: true,
         maintainSelected: false,
         maintainSelected: false,
+        searchTimeOut: 500,
 
 
         rowStyle: function (row, index) {return {};},
         rowStyle: function (row, index) {return {};},
 
 
@@ -640,12 +641,13 @@
                 '</div>');
                 '</div>');
 
 
             this.$toolbar.append(html.join(''));
             this.$toolbar.append(html.join(''));
+            var timeOut = this.options.searchTimeOut;
             $search = this.$toolbar.find('.search input');
             $search = this.$toolbar.find('.search input');
             $search.off('keyup').on('keyup', function (event) {
             $search.off('keyup').on('keyup', function (event) {
                 clearTimeout(timeoutId); // doesn't matter if it's 0
                 clearTimeout(timeoutId); // doesn't matter if it's 0
                 timeoutId = setTimeout(function () {
                 timeoutId = setTimeout(function () {
                     that.onSearch(event);
                     that.onSearch(event);
-                }, 500); // 500ms
+                }, timeOut);
             });
             });
         }
         }
     };
     };