浏览代码

Merge pull request #1752 from bitcrowd/bugfix/fix_searchText_cookie_set_by_column_filters

fix searchtext cookie set by column filters
wenzhixin 10 年之前
父节点
当前提交
7e7d2d63fc
共有 1 个文件被更改,包括 6 次插入2 次删除
  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) {