From 20d87d933eaf724c88d9ce27a585c72b89cd635e Mon Sep 17 00:00:00 2001 From: larsbonczek <44197504+larsbonczek@users.noreply.github.com> Date: Fri, 10 May 2019 20:55:16 +0200 Subject: [PATCH] Fix search being canceled when filters emptied Only reset the lastSearch and lastCombinedFilter variables if the filters were equal before. We don't need to "force filter refresh" if the filters were not equal anyways. --- js/jquery.tablesorter.widgets.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/js/jquery.tablesorter.widgets.js b/js/jquery.tablesorter.widgets.js index 1f75aacf..faba0a9f 100644 --- a/js/jquery.tablesorter.widgets.js +++ b/js/jquery.tablesorter.widgets.js @@ -1363,12 +1363,14 @@ } // return if the last search is the same; but filter === false when updating the search // see example-widget-filter.html filter toggle buttons - if ( tsf.equalFilters(c, c.lastSearch, currentFilters) && filter !== false ) { - return; - } else if ( filter === false ) { - // force filter refresh - c.lastCombinedFilter = ''; - c.lastSearch = []; + if ( tsf.equalFilters(c, c.lastSearch, currentFilters) ) { + if ( filter !== false ) { + return; + } else { + // force filter refresh + c.lastCombinedFilter = ''; + c.lastSearch = []; + } } // define filter inside it is false filters = filters || [];