Browse Source

Merge pull request #1022 from Xandertje/patch-2

Updated cookie extension with selectPage Method.
文翼 10 years ago
parent
commit
c8d29e6a0f
1 changed files with 6 additions and 0 deletions
  1. 6 0
      src/extensions/cookie/bootstrap-table-cookie.js

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

@@ -112,6 +112,7 @@
         _onPageNext = BootstrapTable.prototype.onPageNext,
         _onPageNext = BootstrapTable.prototype.onPageNext,
         _onPageLast = BootstrapTable.prototype.onPageLast,
         _onPageLast = BootstrapTable.prototype.onPageLast,
         _toggleColumn = BootstrapTable.prototype.toggleColumn,
         _toggleColumn = BootstrapTable.prototype.toggleColumn,
+        _selectPage = BootstrapTable.prototype.selectPage,
         _onSearch = BootstrapTable.prototype.onSearch;
         _onSearch = BootstrapTable.prototype.onSearch;
 
 
     // init save data after initTable function
     // init save data after initTable function
@@ -203,6 +204,11 @@
 
 
         setCookie(this, cookieIds.columns, JSON.stringify(visibleColumns));
         setCookie(this, cookieIds.columns, JSON.stringify(visibleColumns));
     };
     };
+    
+    BootstrapTable.prototype.selectPage = function (page) {
+        _selectPage.apply(this, Array.prototype.slice.apply(arguments));
+        setCookie(this, idsStateSaveList.pageNumber, page);
+    };
 
 
     BootstrapTable.prototype.onSearch = function () {
     BootstrapTable.prototype.onSearch = function () {
         _onSearch.apply(this, Array.prototype.slice.apply(arguments));
         _onSearch.apply(this, Array.prototype.slice.apply(arguments));