浏览代码

feat(js): fix #2414, add paginationLoop option

zhixin 9 年之前
父节点
当前提交
55059c5089
共有 1 个文件被更改,包括 11 次插入0 次删除
  1. 11 0
      src/bootstrap-table.js

+ 11 - 0
src/bootstrap-table.js

@@ -313,6 +313,7 @@
         },
         pagination: false,
         onlyInfoPagination: false,
+        paginationLoop: true,
         sidePagination: 'client', // client or server
         totalRows: 0, // server side need to set
         pageNumber: 1,
@@ -1499,6 +1500,16 @@
                 // when data is empty, hide the pagination
                 this.$pagination[this.getData().length ? 'show' : 'hide']();
             }
+
+            if (!this.options.paginationLoop) {
+                if (this.options.pageNumber === 1) {
+                    $pre.addClass('disabled');
+                }
+                if (this.options.pageNumber === this.totalPages) {
+                    $next.addClass('disabled');
+                }
+            }
+
             if ($allSelected) {
                 this.options.pageSize = this.options.formatAllRows();
             }