Browse Source

when there are two or more rows and they have different sizes, the cells are corrected sizes

cesaralejandro.nieto.ramirez 4 years ago
parent
commit
7a2aa8d28e
1 changed files with 10 additions and 3 deletions
  1. 10 3
      src/extensions/sticky-header/bootstrap-table-sticky-header.js

+ 10 - 3
src/extensions/sticky-header/bootstrap-table-sticky-header.js

@@ -107,9 +107,16 @@ $.BootstrapTable = class extends $.BootstrapTable {
     // show sticky when top anchor touches header, and when bottom anchor not exceeded
     // show sticky when top anchor touches header, and when bottom anchor not exceeded
     if (top > start && top <= end) {
     if (top > start && top <= end) {
       // ensure clone and source column widths are the same
       // 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:eq(0)').find('th').each((index, el) => {
+      //   $(el).css('min-width', this.$header.find('tr:eq(0)').find('th').eq(index).css('width'))
+      // })
+      // "y" axis
+      this.$stickyHeader.find('tr').map(function(index, el) {
+        var axis_x = $(el).find('th');
+        axis_x.each(function(indexX, elX) {
+          $__default['default'](elX).css('min-width', _this4.$header.find('tr:eq('+index+')').find('th:eq('+ indexX+')').css('width'));
+        });
+      });
       // match bootstrap table style
       // match bootstrap table style
       this.$stickyContainer.show().addClass('fix-sticky fixed-table-container')
       this.$stickyContainer.show().addClass('fix-sticky fixed-table-container')
       // stick it in position
       // stick it in position