collapsibleContainer.js: Properly set an collapsible's height

This commit is contained in:
Johannes Meyer 2019-06-06 14:16:50 +02:00
parent fb83bee924
commit 1032a944b4
1 changed files with 4 additions and 4 deletions

View File

@ -75,7 +75,7 @@
if (this.expandedContainers[collapsiblePath]) {
this.expandedContainers[collapsiblePath] = false;
$collapsible.removeClass('collapsed');
$collapsible.css({ maxHeight: 'none' });
$collapsible.css({display: '', height: ''});
} else {
this.expandedContainers[collapsiblePath] = true;
$collapsible.addClass('collapsed');
@ -84,14 +84,14 @@
if (!! rowSelector) {
var $rows = $(rowSelector, $collapsible).slice(0, $collapsible.data('numofrows') || this.defaultNumOfRows);
var totalHeight = 0;
var totalHeight = $rows.offset().top - $collapsible.offset().top;
$rows.outerHeight(function (_, height) {
totalHeight += height;
});
$collapsible.css({maxHeight: totalHeight});
$collapsible.css({display: 'block', height: totalHeight});
} else {
$collapsible.css({maxHeight: $collapsible.data('height') || this.defaultHeight});
$collapsible.css({display: 'block', height: $collapsible.data('height') || this.defaultHeight});
}
}
};