Allow to define row count after which a collapsible can be collapsed

This commit is contained in:
Yonas Habteab 2023-08-30 10:55:58 +02:00 committed by Johannes Meyer
parent ce012dcdb2
commit d186604b62
1 changed files with 12 additions and 5 deletions

View File

@ -320,14 +320,21 @@
let rowSelector = this.getRowSelector(collapsible);
if (!! rowSelector) {
let visibleRows = Number(collapsible.dataset.visibleRows);
if (isNaN(visibleRows)) {
visibleRows = this.defaultVisibleRows;
} else if (visibleRows === 0) {
let collapseAfter = Number(collapsible.dataset.collapseAfter)
if (isNaN(collapseAfter)) {
collapseAfter = Number(collapsible.dataset.visibleRows);
if (isNaN(collapseAfter)) {
collapseAfter = this.defaultVisibleRows;
}
collapseAfter *= 2;
}
if (collapseAfter === 0) {
return true;
}
return collapsible.querySelectorAll(rowSelector).length > visibleRows * 2;
return collapsible.querySelectorAll(rowSelector).length > collapseAfter;
} else {
let maxHeight = Number(collapsible.dataset.visibleHeight);
if (isNaN(maxHeight)) {