Browse Source

Merge pull request #45 from wenzhixin/master

Update my repo
Dennis Hernández 10 years ago
parent
commit
c8000ab239
2 changed files with 25 additions and 11 deletions
  1. 1 11
      src/bootstrap-table.js
  2. 24 0
      src/extensions/cookie/bootstrap-table-cookie.js

+ 1 - 11
src/bootstrap-table.js

@@ -300,12 +300,6 @@
         onPostHeader: function () {
             return false;
         },
-        onPreRows: function () {
-            return false;
-        },
-        onPostRows: function () {
-            return false;
-        },
         onExpandRow: function (index, row, $detail) {
             return false;
         },
@@ -398,8 +392,6 @@
         'pre-body.bs.table': 'onPreBody',
         'post-body.bs.table': 'onPostBody',
         'post-header.bs.table': 'onPostHeader',
-        'pre-rows.bs.table': 'onPreRows',
-        'post-rows.bs.table': 'onPostRows',
         'expand-row.bs.table': 'onExpandRow',
         'collapse-row.bs.table': 'onCollapseRow'
     };
@@ -1383,9 +1375,7 @@
                 '</tr>');
         }
 
-        this.trigger('pre-rows');
         this.$body.html(html.join(''));
-        this.trigger('post-rows');
 
         if (!fixedScroll) {
             this.scrollTo(0);
@@ -2212,7 +2202,7 @@
         'getOptions',
         'getSelections', 'getAllSelections', 'getData',
         'load', 'append', 'prepend', 'remove', 'removeAll',
-        'insertRow', 'updateRow', 'removeByUniqueId',
+        'insertRow', 'updateRow', 'updateCell', 'removeByUniqueId',
         'showRow', 'hideRow', 'getRowsHidden',
         'mergeCells',
         'checkAll', 'uncheckAll',

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

@@ -107,6 +107,10 @@
         _onSort = BootstrapTable.prototype.onSort,
         _onPageNumber = BootstrapTable.prototype.onPageNumber,
         _onPageListChange = BootstrapTable.prototype.onPageListChange,
+        _onPageFirst = BootstrapTable.prototype.onPageFirst,
+        _onPagePre = BootstrapTable.prototype.onPagePre,
+        _onPageNext = BootstrapTable.prototype.onPageNext,
+        _onPageLast = BootstrapTable.prototype.onPageLast,
         _toggleColumn = BootstrapTable.prototype.toggleColumn,
         _onSearch = BootstrapTable.prototype.onSearch;
 
@@ -180,6 +184,26 @@
         setCookie(this, idsStateSaveList.pageList, this.options.pageSize);
     };
 
+    BootstrapTable.prototype.onPageFirst = function () {
+        _onPageFirst.apply(this, Array.prototype.slice.apply(arguments));
+        setCookie(this, idsStateSaveList.pageNumber, this.options.pageNumber);
+    };
+
+    BootstrapTable.prototype.onPagePre = function () {
+        _onPagePre.apply(this, Array.prototype.slice.apply(arguments));
+        setCookie(this, idsStateSaveList.pageNumber, this.options.pageNumber);
+    };
+
+    BootstrapTable.prototype.onPageNext = function () {
+        _onPageNext.apply(this, Array.prototype.slice.apply(arguments));
+        setCookie(this, idsStateSaveList.pageNumber, this.options.pageNumber);
+    };
+
+    BootstrapTable.prototype.onPageLast = function () {
+        _onPageLast.apply(this, Array.prototype.slice.apply(arguments));
+        setCookie(this, idsStateSaveList.pageNumber, this.options.pageNumber);
+    };
+
     BootstrapTable.prototype.toggleColumn = function () {
         _toggleColumn.apply(this, Array.prototype.slice.apply(arguments));