浏览代码

Fix #279: scrollWidth bug.

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

+ 6 - 1
src/bootstrap-table.js

@@ -1493,6 +1493,7 @@
         var that = this,
         var that = this,
             $fixedHeader,
             $fixedHeader,
             $fixedBody,
             $fixedBody,
+            fixedBody,
             scrollWidth;
             scrollWidth;
 
 
         if (that.$el.is(':hidden')) {
         if (that.$el.is(':hidden')) {
@@ -1501,7 +1502,11 @@
         }
         }
         $fixedHeader = this.$container.find('.fixed-table-header');
         $fixedHeader = this.$container.find('.fixed-table-header');
         $fixedBody = this.$container.find('.fixed-table-body');
         $fixedBody = this.$container.find('.fixed-table-body');
-        scrollWidth = this.$el.width() > $fixedBody.width() ? getScrollBarWidth() : 0;
+        fixedBody = $fixedBody.get(0);
+
+        scrollWidth = fixedBody.scrollWidth > fixedBody.clientWidth &&
+            fixedBody.scrollHeight > fixedBody.clientHeight + this.$header.height() ?
+            getScrollBarWidth() : 0;
 
 
         this.$el.css('margin-top', -this.$header.height());
         this.$el.css('margin-top', -this.$header.height());
         this.$header_ = this.$header.clone(true, true);
         this.$header_ = this.$header.clone(true, true);