Is there a function to get the max depth of the tree?
I would use walk and in the callback check the length of the path array which is essentially the depth of the node in the tree.
hope that helps!
That did it thanks!
For anyone wondering, this is what I did:
let depth = 0;
walk({
treeData: treeData,
getNodeKey,
callback: (node) => {
if(node.path.length > depth) depth= node.path.length;
},
});
@anushkadoyan, cool example, maybe we can create a storybook example so other people don't have the same pains... I will try to update it sometime this week...
I also forgot about this helpful utility function getDepth https://github.com/frontend-collective/react-sortable-tree/blob/master/src/utils/tree-data-utils.js#L1038
Most helpful comment
That did it thanks!
For anyone wondering, this is what I did: