浏览代码

Merge pull request #5692 from cesarn/develop

fix bootstrap-table-sticky-header
Dustin Utecht 4 年之前
父节点
当前提交
d82d7ed0a4
共有 1 个文件被更改,包括 6 次插入2 次删除
  1. 6 2
      src/extensions/sticky-header/bootstrap-table-sticky-header.js

+ 6 - 2
src/extensions/sticky-header/bootstrap-table-sticky-header.js

@@ -107,8 +107,12 @@ $.BootstrapTable = class extends $.BootstrapTable {
     // show sticky when top anchor touches header, and when bottom anchor not exceeded
     if (top > start && top <= end) {
       // ensure clone and source column widths are the same
-      this.$stickyHeader.find('tr:eq(0)').find('th').each((index, el) => {
-        $(el).css('min-width', this.$header.find('tr:eq(0)').find('th').eq(index).css('width'))
+      this.$stickyHeader.find('tr').each((indexRows, rows) => {
+        const columns = $(rows).find('th')
+
+        columns.each((indexColumns, celd) => {
+          $(celd).css('min-width', this.$header.find(`tr:eq(${indexRows})`).find(`th:eq(${indexColumns})`).css('width'))
+        })
       })
       // match bootstrap table style
       this.$stickyContainer.show().addClass('fix-sticky fixed-table-container')