Allow to define row count after which a collapsible can be collapsed
This commit is contained in:
parent
ce012dcdb2
commit
d186604b62
|
@ -320,14 +320,21 @@
|
||||||
|
|
||||||
let rowSelector = this.getRowSelector(collapsible);
|
let rowSelector = this.getRowSelector(collapsible);
|
||||||
if (!! rowSelector) {
|
if (!! rowSelector) {
|
||||||
let visibleRows = Number(collapsible.dataset.visibleRows);
|
let collapseAfter = Number(collapsible.dataset.collapseAfter)
|
||||||
if (isNaN(visibleRows)) {
|
if (isNaN(collapseAfter)) {
|
||||||
visibleRows = this.defaultVisibleRows;
|
collapseAfter = Number(collapsible.dataset.visibleRows);
|
||||||
} else if (visibleRows === 0) {
|
if (isNaN(collapseAfter)) {
|
||||||
|
collapseAfter = this.defaultVisibleRows;
|
||||||
|
}
|
||||||
|
|
||||||
|
collapseAfter *= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (collapseAfter === 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return collapsible.querySelectorAll(rowSelector).length > visibleRows * 2;
|
return collapsible.querySelectorAll(rowSelector).length > collapseAfter;
|
||||||
} else {
|
} else {
|
||||||
let maxHeight = Number(collapsible.dataset.visibleHeight);
|
let maxHeight = Number(collapsible.dataset.visibleHeight);
|
||||||
if (isNaN(maxHeight)) {
|
if (isNaN(maxHeight)) {
|
||||||
|
|
Loading…
Reference in New Issue