feat: Blazor 模式下固定表头是增加高度动态调整功能

This commit is contained in:
Argo Zhang 2020-01-22 15:34:25 +08:00
parent 38134e2f0a
commit ca3cbdc6e5
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
2 changed files with 18 additions and 1 deletions

View File

@ -135,7 +135,7 @@ nav .dropdown .nav-link-close.dropdown-toggle:after {
}
.bootstrap-table .fixed-table-body {
height: 300px;
min-height: 400px;
}
.bootstrap-table .fixed-table-body table {

View File

@ -152,10 +152,26 @@
$(header).width($(element).width());
});
},
resetTableHeight(source) {
var table = source;
var height = 0;
do {
height += source.position().top;
source = source.parent();
if (source.hasClass('tab-content')) break;
}
while (source.length === 1);
height = $(window).height() - height - 15;
table.height(height);
},
initTable: function (id, firstRender) {
var $table = $('#' + id);
var $fixedBody = $table.parents('.fixed-table-body');
if (firstRender) {
// calc height
$.resetTableHeight($fixedBody);
// modify scroll
$table.parent().overlayScrollbars({
className: 'os-theme-dark',
@ -175,6 +191,7 @@
$(window).on('resize', function () {
$.resetTableWidth($table, $tableHeader);
$.resetTableHeight($fixedBody);
});
}
}