ソースを参照

Fix #2085

Example: http://jsfiddle.net/djhvscf/4r6g4cfu/220/
Dennis Hernández 9 年 前
コミット
dd45f96cf4
1 ファイル変更8 行追加3 行削除
  1. 8 3
      src/bootstrap-table.js

+ 8 - 3
src/bootstrap-table.js

@@ -2102,7 +2102,8 @@
             that.$header_.find(sprintf('th[data-field="%s"]', $(this).data('field'))).data($(this).data());
             that.$header_.find(sprintf('th[data-field="%s"]', $(this).data('field'))).data($(this).data());
         });
         });
 
 
-        var visibleFields = this.getVisibleFields();
+        var visibleFields = this.getVisibleFields(),
+            ths = this.$header_.find('th');
 
 
         this.$body.find('>tr:first-child:not(.no-records-found) > *').each(function (i) {
         this.$body.find('>tr:first-child:not(.no-records-found) > *').each(function (i) {
             var $this = $(this),
             var $this = $(this),
@@ -2115,8 +2116,12 @@
                 index = i - 1;
                 index = i - 1;
             }
             }
 
 
-            that.$header_.find(sprintf('th[data-field="%s"]', visibleFields[index]))
-                .find('.fht-cell').width($this.innerWidth());
+            var th = that.$header_.find(sprintf('th[data-field="%s"]', visibleFields[index]));
+            if (th.length > 1) {
+                th = $(ths[$this[0].cellIndex]);
+            }
+
+            th.find('.fht-cell').width($this.innerWidth());
         });
         });
         // horizontal scroll event
         // horizontal scroll event
         // TODO: it's probably better improving the layout than binding to scroll event
         // TODO: it's probably better improving the layout than binding to scroll event