冻结列右侧自适应

dep_wangsr
RuoYi 4 years ago committed by Limy
parent 290fe0ee9d
commit c85e3758d7

@ -57,7 +57,7 @@
this.$rightfixedBodyColumns = this.$rightfixedBody.find('tbody'); this.$rightfixedBodyColumns = this.$rightfixedBody.find('tbody');
this.$tableBody.before(this.$rightfixedBody); this.$tableBody.before(this.$rightfixedBody);
if (this.options.fixedColumns) { if (this.options.fixedColumns) {
$('.right-fixed-table-columns').attr('style','right:0px'); $('.right-fixed-table-columns').attr('style','right:0px;');
} }
} }
}; };
@ -183,21 +183,16 @@
this.$fixedHeader.width(headerWidth + 2).show(); this.$fixedHeader.width(headerWidth + 2).show();
} }
if (that.options.rightFixedColumns) { if (that.options.rightFixedColumns) {
headerWidth = 0;
var totalLength = $("#" + table.options.id).find('th').length;
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),
index = i; index = totalLength - i - 1;
if (i >= visibleFields.length - that.options.rightFixedNumber) { if (i >= that.options.rightFixedNumber) {
return false; return false;
}
headerWidth += $("#" + table.options.id).find("tr:first-child>th").eq(index).width();
if (that.options.detailView && !that.options.cardView) {
index = i - 1;
}
that.$rightfixedBody.find('thead th[data-field="' + visibleFields[index] + '"]')
.find('.fht-cell').width($this.innerWidth() - 1);
headerWidth += $this.outerWidth();
}
}); });
this.$rightfixedBody.width(headerWidth - 1).show(); this.$rightfixedBody.width(headerWidth - 1).show();
} }
@ -230,6 +225,7 @@
var resizeHeight = bsHeight > fixedHeight ? bsHeight: fixedHeight; var resizeHeight = bsHeight > fixedHeight ? bsHeight: fixedHeight;
this.$body.find('> tr').each(function (i) { this.$body.find('> tr').each(function (i) {
that.$fixedBody.find('tr:eq(' + i + ')').height(i == 0 ? resizeHeight - 1 : resizeHeight); that.$fixedBody.find('tr:eq(' + i + ')').height(i == 0 ? resizeHeight - 1 : resizeHeight);
$("#" + table.options.id).find('tbody>tr:eq(' + i + ')').height(resizeHeight);
var thattds = this; var thattds = this;
that.$fixedBody.find('tr:eq(' + i + ')').find('td').each(function (j) { that.$fixedBody.find('tr:eq(' + i + ')').find('td').each(function (j) {
$(this).width($($(thattds).find('td')[j]).width() + 1); $(this).width($($(thattds).find('td')[j]).width() + 1);

Loading…
Cancel
Save