ソースを参照

Fix #2002

Added a built-in resize event where we fit the header automatically when
the user resizes the window
Dennis Hernández 9 年 前
コミット
aa9b4d2bd2
1 ファイル変更11 行追加0 行削除
  1. 11 0
      src/bootstrap-table.js

+ 11 - 0
src/bootstrap-table.js

@@ -229,6 +229,16 @@
         return !!(navigator.userAgent.indexOf("MSIE ") > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./));
     };
 
+    var fitHeaderOnDocumentResizeEvent = function (that) {
+        if (that.options.height) {
+            $(window).resize(function () {
+                setTimeout (function () {
+                    that.fitHeader();
+                }, 250);
+            });
+        }
+    };
+
     // BOOTSTRAP TABLE CLASS DEFINITION
     // ======================
 
@@ -2168,6 +2178,7 @@
             this.$tableHeader.show();
             this.resetHeader();
             padding += this.$header.outerHeight();
+            fitHeaderOnDocumentResizeEvent(this);
         } else {
             this.$tableHeader.hide();
             this.trigger('post-header');