From a4a681f385fdd84b51fb3f40c119f04d771bdbc4 Mon Sep 17 00:00:00 2001 From: Joris Vandermeersch Date: Fri, 31 Mar 2017 15:31:20 +0200 Subject: [PATCH 1/2] keep timeout per column, not globally - fixes issue where leaving a filter field too quickly (by using tab to move to the next field) would ignore the value just entered. --- .../filter-control/bootstrap-table-filter-control.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/extensions/filter-control/bootstrap-table-filter-control.js b/src/extensions/filter-control/bootstrap-table-filter-control.js index 3dae40b64d..44e2bf3aa7 100644 --- a/src/extensions/filter-control/bootstrap-table-filter-control.js +++ b/src/extensions/filter-control/bootstrap-table-filter-control.js @@ -317,15 +317,15 @@ if (addedFilterControl) { header.off('keyup', 'input').on('keyup', 'input', function (event) { - clearTimeout(timeoutId); - timeoutId = setTimeout(function () { + clearTimeout(event.currentTarget.timeoutId); + event.currentTarget.timeoutId = setTimeout(function () { that.onColumnSearch(event); }, that.options.searchTimeOut); }); header.off('change', 'select').on('change', 'select', function (event) { - clearTimeout(timeoutId); - timeoutId = setTimeout(function () { + clearTimeout(event.currentTarget.timeoutId); + event.currentTarget.timeoutId = setTimeout(function () { that.onColumnSearch(event); }, that.options.searchTimeOut); }); @@ -342,8 +342,8 @@ var newValue = $input.val(); if (newValue === "") { - clearTimeout(timeoutId); - timeoutId = setTimeout(function () { + clearTimeout(event.currentTarget.timeoutId); + event.currentTarget.timeoutId = setTimeout(function () { that.onColumnSearch(event); }, that.options.searchTimeOut); } From 950c2b0e35602cafeb0285587a14300c0f834ca3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=87=E7=BF=BC?= Date: Thu, 14 Dec 2017 16:52:15 +0800 Subject: [PATCH 2/2] Update bootstrap-table-filter-control.js --- .../filter-control/bootstrap-table-filter-control.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/extensions/filter-control/bootstrap-table-filter-control.js b/src/extensions/filter-control/bootstrap-table-filter-control.js index 78f76e21e4..b3c6ccfad6 100644 --- a/src/extensions/filter-control/bootstrap-table-filter-control.js +++ b/src/extensions/filter-control/bootstrap-table-filter-control.js @@ -318,7 +318,7 @@ return; } - clearTimeout(event.currentTarget.timeoutId); + clearTimeout(event.currentTarget.timeoutId || 0); event.currentTarget.timeoutId = setTimeout(function () { that.onColumnSearch(event); }, that.options.searchTimeOut); @@ -333,7 +333,7 @@ return; } - clearTimeout(event.currentTarget.timeoutId); + clearTimeout(event.currentTarget.timeoutId || 0); event.currentTarget.timeoutId = setTimeout(function () { that.onColumnSearch(event); }, that.options.searchTimeOut); @@ -351,7 +351,7 @@ var newValue = $input.val(); if (newValue === "") { - clearTimeout(event.currentTarget.timeoutId); + clearTimeout(event.currentTarget.timeoutId || 0); event.currentTarget.timeoutId = setTimeout(function () { that.onColumnSearch(event); }, that.options.searchTimeOut);