Browse Source

Updated cookie extension with selectPage Method.

Updated cookie extension to extend the selectPage Method so that it updates the state save page number cookie.
Xandertje 11 years ago
parent
commit
d9d86af500
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,
         _onPageLast = BootstrapTable.prototype.onPageLast,
         _toggleColumn = BootstrapTable.prototype.toggleColumn,
+        _selectPage = BootstrapTable.prototype.selectPage,
         _onSearch = BootstrapTable.prototype.onSearch;
 
     // init save data after initTable function
@@ -203,6 +204,11 @@
 
         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 () {
         _onSearch.apply(this, Array.prototype.slice.apply(arguments));