Browse Source

Merge pull request #5 from wenzhixin/develop

Update branch
Dennis Hernández 9 years ago
parent
commit
d3b7baed57
3 changed files with 10 additions and 12 deletions
  1. 1 0
      CHANGELOG.md
  2. 7 0
      src/bootstrap-table.css
  3. 2 12
      src/bootstrap-table.js

+ 1 - 0
CHANGELOG.md

@@ -9,6 +9,7 @@ ChangeLog
 - fix(js): fix #750, showRow and hideRow bug
 - fix(js): fix #2387, page list bug
 - fix(js): decrement totalRows on remove if using server side pagination
+- fix(js): bug in the calculation of toolbar and pagination heights
 - feat(js): fix #2414, add `paginationLoop` option
 - feat(js): update method `getRowsHidden` to `getHiddenRows`
 - feat(js): add `sortClass` option

+ 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');