#895 fix colums sorting

This commit is contained in:
Dániel Péter Sipos
2020-10-16 17:05:46 +02:00
parent 622871fcde
commit 3d1ffa6738

View File

@@ -172,13 +172,18 @@ export class ObjectGridComponent implements OnInit {
const result = []; const result = [];
let index = 0;
page.forEach((obj: ListableObject, i: number) => { page.forEach((obj: ListableObject, i: number) => {
const colNb = i % nbColumns;
let col = result[colNb]; if (i % nbColumns === 0 && i > 0) {
index++;
}
let col = result[index];
if (hasNoValue(col)) { if (hasNoValue(col)) {
col = []; col = [];
} }
result[colNb] = [...col, obj]; result[index] = [...col, obj];
}); });
return result; return result;
} else { } else {