frontend-collective / frontend-collective/react-sortable-tree
How to calculate "path" by the "treeData" and "node" ?
- Dominant language
- JavaScript
- Stars
- 5k
- Forks
- 914
- PR merge metrics
- No merged PRs in 30d
Description
Hi, guys.
I have treeData and currentNode.
Please, help me to calculate the "path" of this node in the tree, like as [0, 1, 27, 82, 105, ...].
`
const treeData = [
{
dragDisabled: true,
dropDisabled: false,
expanded: true,
id: "325b55d9-6937-4b38-8de3-53877c853974:0",
isCustom: true,
isDirectory: true,
parentId: null,
children: {
dragDisabled: false,
dropDisabled: true,
id: "-111222460",
isCustom: true,
isDirectory: false,
parentId: "325b55d9-6937-4b38-8de3-53877c853974:0",
title: "aaa222",
},
{
dragDisabled: false,
dropDisabled: true,
id: "-111222461",
isCustom: true,
isDirectory: false,
parentId: "325b55d9-6937-4b38-8de3-53877c853974:0",
title: "aaa333",
},
{
dragDisabled: false,
dropDisabled: true,
id: "-111222462",
isCustom: true,
isDirectory: false,
parentId: "325b55d9-6937-4b38-8de3-53877c853974:0",
title: "aa444",
}
]
`
`
const currentNode = {
dragDisabled: false,
dropDisabled: true,
id: "-111222462",
isCustom: true,
isDirectory: false,
parentId: "325b55d9-6937-4b38-8de3-53877c853974:0",
title: "aa444",
}
`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.