Browse Source

Merge pull request #1752 from bitcrowd/bugfix/fix_searchText_cookie_set_by_column_filters

fix searchtext cookie set by column filters
wenzhixin 10 years ago
parent
commit
7e7d2d63fc
1 changed files with 6 additions and 2 deletions
  1. 6 2
      src/extensions/cookie/bootstrap-table-cookie.js

+ 6 - 2
src/extensions/cookie/bootstrap-table-cookie.js

@@ -317,8 +317,12 @@
     };
 
     BootstrapTable.prototype.onSearch = function () {
-        _onSearch.apply(this, Array.prototype.slice.apply(arguments));
-        setCookie(this, cookieIds.searchText, this.searchText);
+        var target = Array.prototype.slice.apply(arguments);
+        _onSearch.apply(this, target);
+
+        if ($(target[0].currentTarget).parent().hasClass('search')) {
+          setCookie(this, cookieIds.searchText, this.searchText);
+        }
     };
 
     BootstrapTable.prototype.deleteCookie = function (cookieName) {