Browse Source

Fixed a bug in the calculation of toolbar and pagination heights, if there is a inner div on the next line (#2405)

bezany 9 years ago
parent
commit
3ecffa7756
2 changed files with 9 additions and 12 deletions
  1. 7 0
      src/bootstrap-table.css
  2. 2 12
      src/bootstrap-table.js

+ 7 - 0
src/bootstrap-table.css

@@ -304,3 +304,10 @@ div.fixed-table-scroll-outer {
     height: 150px;
     overflow: hidden;
 }
+
+/* for get correct heights  */
+.fixed-table-toolbar:after, .fixed-table-pagination:after {
+  content:"";
+  display:block;
+  clear:both;
+}

+ 2 - 12
src/bootstrap-table.js

@@ -190,16 +190,6 @@
         return text;
     };
 
-    var getRealHeight = function ($el) {
-        var height = 0;
-        $el.children().each(function () {
-            if (height < $(this).outerHeight(true)) {
-                height = $(this).outerHeight(true);
-            }
-        });
-        return height;
-    };
-
     var getRealDataAttr = function (dataAttr) {
         for (var attr in dataAttr) {
             var auxAttr = attr.split(/(?=[A-Z])/).join('-').toLowerCase();
@@ -2318,8 +2308,8 @@
             this.$selectItem.length === this.$selectItem.filter(':checked').length);
 
         if (this.options.height) {
-            var toolbarHeight = getRealHeight(this.$toolbar),
-                paginationHeight = getRealHeight(this.$pagination),
+            var toolbarHeight = this.$toolbar.outerHeight(true),
+                paginationHeight = this.$pagination.outerHeight(true),
                 height = this.options.height - toolbarHeight - paginationHeight;
 
             this.$tableContainer.css('height', height + 'px');