Browse Source

Merge pull request #1680 from dabros/patch-3

fixed paginationSwitch for server-side #1677
wenzhixin 10 years ago
parent
commit
212fdaf33d
1 changed files with 8 additions and 5 deletions
  1. 8 5
      src/bootstrap-table.js

+ 8 - 5
src/bootstrap-table.js

@@ -1742,16 +1742,19 @@
     BootstrapTable.prototype.initServer = function (silent, query) {
     BootstrapTable.prototype.initServer = function (silent, query) {
         var that = this,
         var that = this,
             data = {},
             data = {},
-            params = {
-                pageSize: this.options.pageSize === this.options.formatAllRows() ?
-                    this.options.totalRows : this.options.pageSize,
-                pageNumber: this.options.pageNumber,
+            params = {                
                 searchText: this.searchText,
                 searchText: this.searchText,
                 sortName: this.options.sortName,
                 sortName: this.options.sortName,
                 sortOrder: this.options.sortOrder
                 sortOrder: this.options.sortOrder
             },
             },
             request;
             request;
 
 
+        if(this.options.pagination) {
+            params.pageSize = this.options.pageSize === this.options.formatAllRows() ?
+                this.options.totalRows : this.options.pageSize;
+            params.pageNumber = this.options.pageNumber;
+        }
+
         if (!this.options.url && !this.options.ajax) {
         if (!this.options.url && !this.options.ajax) {
             return;
             return;
         }
         }
@@ -2732,4 +2735,4 @@
     $(function () {
     $(function () {
         $('[data-toggle="table"]').bootstrapTable();
         $('[data-toggle="table"]').bootstrapTable();
     });
     });
-}(jQuery);
+}(jQuery);