ソースを参照

Fix #639: footer resizing problem.

zhixin 10 年 前
コミット
c266a57d14
2 ファイル変更23 行追加9 行削除
  1. 11 4
      src/bootstrap-table.css
  2. 12 5
      src/bootstrap-table.js

+ 11 - 4
src/bootstrap-table.css

@@ -41,9 +41,6 @@
 .fixed-table-footer,
 .fixed-table-header {
     overflow: hidden;
-    border-radius: 4px 4px 0 0;
-    -webkit-border-radius: 4px 4px 0 0;
-    -moz-border-radius: 4px 4px 0 0;
 }
 
 .fixed-table-footer {
@@ -74,7 +71,8 @@
     -moz-border-radius-topleft: 4px;
 }
 
-.fixed-table-container thead th .th-inner {
+.fixed-table-container thead th .th-inner,
+.fixed-table-container tbody td .th-inner {
     padding: 8px;
     line-height: 24px;
     vertical-align: top;
@@ -269,6 +267,15 @@
     margin: 0;
 }
 
+.bootstrap-table .fixed-table-footer tbody > tr > td {
+    padding: 0 !important;
+}
+
+.bootstrap-table .fixed-table-footer .table {
+    border-bottom: none;
+    border-radius: 0;
+}
+
 .pull-right .dropdown-menu {
     right: 0;
     left: auto;

+ 12 - 5
src/bootstrap-table.js

@@ -1825,7 +1825,7 @@
         this.$tableBody.off('scroll').on('scroll', function () {
             that.$tableHeader.scrollLeft($(this).scrollLeft());
 
-            if (this.options.showFooter && !this.options.cardView) {
+            if (that.options.showFooter && !that.options.cardView) {
                 that.$tableFooter.scrollLeft($(this).scrollLeft());
             }
         });
@@ -1842,7 +1842,7 @@
         }
 
         if (!this.options.cardView && this.options.detailView) {
-            html.push('<td></td>');
+            html.push('<td><div class="th-inner">&nbsp;</div><div class="fht-cell"></div></td>');
         }
 
         $.each(this.columns, function (i, column) {
@@ -1862,8 +1862,13 @@
             style = sprintf('vertical-align: %s; ', column.valign);
 
             html.push('<td', class_, sprintf(' style="%s"', falign + style), '>');
+            html.push('<div class="th-inner">');
 
             html.push(calculateObjectValue(column, column.footerFormatter, [data], '&nbsp;') || '&nbsp;');
+
+            html.push('</div>');
+            html.push('<div class="fht-cell"></div>');
+            html.push('</div>');
             html.push('</td>');
         });
 
@@ -1895,8 +1900,10 @@
 
         $footerTd = this.$tableFooter.find('td');
 
-        this.$tableBody.find('tbody tr:first-child:not(.no-records-found) > td').each(function (i) {
-            $footerTd.eq(i).outerWidth($(this).outerWidth());
+        this.$body.find('tr:first-child:not(.no-records-found) > *').each(function (i) {
+            var $this = $(this);
+
+            $footerTd.eq(i).find('.fht-cell').width($this.innerWidth());
         });
     };
 
@@ -1986,7 +1993,7 @@
         if (this.options.showFooter) {
             this.resetFooter();
             if (this.options.height) {
-                padding += this.$tableFooter.outerHeight();
+                padding += this.$tableFooter.outerHeight() + 1;
             }
         }