minop1205 / react-dnd-treeview

A draggable / droppable React-based treeview component. You can use render props to create each node freely.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add the parent index and the current node index to props

zetorby opened this issue · comments

How can get the index of the parent and the current node to number such a list?
image

@zetorby
Even if parent index or current index is given to render, it may not be enough to obtain the expected prefix if the tree hierarchy is deep.

In any case, it is necessary to go back to the root node to get the index of each hierarchy, so please implement the logic in your application as shown in the example below.

https://codesandbox.io/s/issue-119-l81c14?file=/src/App.tsx

@minop1205 Thank you for your help