Browse Source

Merge pull request #1365 from yenyen/clear-button-filter-control

ColumnSearch after click on clear button in IE
文翼 10 years ago
parent
commit
f9a9bbbe20
1 changed files with 18 additions and 0 deletions
  1. 18 0
      src/extensions/filter-control/bootstrap-table-filter-control.js

+ 18 - 0
src/extensions/filter-control/bootstrap-table-filter-control.js

@@ -246,6 +246,24 @@
                 }, that.options.searchTimeOut);
             });
 
+            header.off('mouseup', 'input').on('mouseup', 'input', function (event) {
+                var $input = $(this),
+                oldValue = $input.val();
+
+                if (oldValue === "") return;
+
+                setTimeout(function(){
+                    var newValue = $input.val();
+
+                    if (newValue === ""){
+                        clearTimeout(timeoutId);
+                        timeoutId = setTimeout(function () {
+                            that.onColumnSearch(event);
+                        }, that.options.searchTimeOut);
+                    }
+                }, 1);
+            });
+
             if (header.find('.date-filter-control').length > 0) {
                 $.each(that.columns, function (i, column) {
                     if (column.filterControl !== undefined && column.filterControl.toLowerCase() === 'datepicker') {