浏览代码

Add bootstrapVersion option.

zhixin 11 年之前
父节点
当前提交
355cb8849b
共有 3 个文件被更改,包括 36 次插入8 次删除
  1. 6 0
      docs/docs.js
  2. 23 6
      src/bootstrap-table.css
  3. 7 2
      src/bootstrap-table.js

+ 6 - 0
docs/docs.js

@@ -20,6 +20,12 @@ $(function () {
             ],
             data: [
                 {
+                    name: 'bootstrapVersion',
+                    type: 'Number',
+                    description: 'Bootstrap version.',
+                    'default': '3'
+                },
+                {
                     name: 'classes',
                     type: 'String',
                     description: 'The class name of table.',

+ 23 - 6
src/bootstrap-table.css

@@ -85,16 +85,38 @@
     text-align: center;
 }
 
-.fixed-table-pagination .pagination {
+
+.fixed-table-pagination .pagination,
+.fixed-table-pagination .pagination-detail {
+    height: 34px;
     margin-top: 10px;
     margin-bottom: 10px;
 }
 
+.fixed-table-pagination .pagination a {
+    padding: 6px 12px;
+    line-height: 1.428571429;
+}
+
 .fixed-table-pagination .pagination-info {
     line-height: 34px;
     margin-right: 5px;
 }
 
+.fixed-table-pagination .btn-group {
+    position: relative;
+    display: inline-block;
+    vertical-align: middle;
+}
+
+.fixed-table-pagination .dropup  .dropdown-menu {
+    margin-bottom: 0;
+}
+
+.fixed-table-pagination .page-list {
+    display: inline-block;
+}
+
 .fixed-table-toolbar .columns {
     margin-left: 5px;
 }
@@ -107,7 +129,6 @@
     line-height: 1.428571429;
 }
 
-.fixed-table-toolbar .page-list,
 .fixed-table-toolbar .search,
 .fixed-table-toolbar .columns {
     position: relative;
@@ -116,10 +137,6 @@
     line-height: 34px;
 }
 
-.fixed-table-toolbar .page-list button {
-    margin: 0 5px;
-}
-
 .fixed-table-pagination li.disabled a {
     pointer-events: none;
     cursor: default;

+ 7 - 2
src/bootstrap-table.js

@@ -56,6 +56,7 @@
     };
 
     BootstrapTable.DEFAULTS = {
+        bootstrapVersion: 3,
         classes: 'table table-hover',
         height: undefined,
         undefinedText: '-',
@@ -418,7 +419,7 @@
         }
 
         html.push(
-            '<div class="pull-left pagination">',
+            '<div class="pull-left pagination-detail">',
                 '<span class="pagination-info">',
                     this.options.formatShowingRows(this.pageFrom, this.pageTo, this.options.totalRows),
                 '</span>');
@@ -759,7 +760,11 @@
             $(this).attr('style', header.styles[i])
                 .css('position', 'absolute')
                 .css('width', width + 'px'); // padding: 8px
-            that.$body.find('tr:eq(0) td').eq(i).css('width', width + 'px'); // fix th width display error
+
+            // fix th width display error
+            if (that.options.bootstrapVersion === 3) {
+                that.$body.find('tr:eq(0) td').eq(i).css('width', width + 'px');
+            }
         });
     };