feat: Sorting by dynamic query.

This commit is contained in:
Ahmed Bouhuolia
2020-04-18 23:33:41 +02:00
parent c0c4e5af4a
commit cdee562ae7
17 changed files with 566 additions and 130 deletions

View File

@@ -37,12 +37,12 @@ export default class NestedSet {
toTree() {
const map = this.linkChildren();
const tree = {};
const tree = [];
this.items.forEach((item) => {
const parentNodeId = item[this.options.parentId];
if (!parentNodeId) {
tree[item.id] = map[item.id];
tree.push(map[item.id]);
}
});
this.collection = Object.values(tree);