浏览代码

#194: Update smartDisplay option.

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

+ 4 - 4
src/bootstrap-table.js

@@ -140,7 +140,7 @@
         showColumns: false,
         showRefresh: false,
         showToggle: false,
-        smartDisplay: false,
+        smartDisplay: true,
         minimumCountColumns: 1,
         idField: undefined,
         cardView: false,
@@ -711,7 +711,7 @@
         }
 
         $.each(pageList, function (i, page) {
-            if (that.options.smartDisplay === false || that.options.totalRows >= page || page == pageList[0]) {
+            if (!that.options.smartDisplay || that.options.totalRows >= page || i === 0) {
                 var active = page === that.options.pageSize ? ' class="active"' : '';
                 pageNumber.push(sprintf('<li%s><a href="javascript:void(0)">%s</a></li>', active, page));
             }
@@ -775,8 +775,8 @@
             if (this.totalPages <= 1) {
                 this.$pagination.find('div.pagination').hide();
             }
-            if (this.options.totalRows <= this.options.pageList[1]) {
-                this.$pagination.find('div.pagination-detail').hide();
+            if (this.options.pageList.length < 2 || this.options.totalRows <= this.options.pageList[1]) {
+                this.$pagination.find('span.page-list').hide();
             }
         }
         $pageList.off('click').on('click', $.proxy(this.onPageListChange, this));