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 a custom element to the end of the list (ul)

zetorby opened this issue · comments

How to add a custom element to the end of the list (ul) ? Example, add button of end list (ul)...

@zetorby Currently there is no such API.
Buttons should be placed outside of Treeview(ul).
Is the following demo helpful?

https://minop1205.github.io/react-dnd-treeview/?path=/story/examples-tree-add-remove-duplicate-nodes--add-remove-duplicate-nodes-story

@zetorby Currently there is no such API. Buttons should be placed outside of Treeview(ul). Is the following demo helpful?

https://minop1205.github.io/react-dnd-treeview/?path=/story/examples-tree-add-remove-duplicate-nodes--add-remove-duplicate-nodes-story

I need to add buttons exactly inside the tree
image

@zetorby
Since this seems to be a special use case, I think it should be implemented on the application side rather than as an API.

One possible implementation would be to check the position of each node in the render API and add a button if it is the last node in the list.

Would the following sample be helpful?
https://codesandbox.io/s/issue-120-jq2o7t?file=/src/App.tsx

@zetorby Since this seems to be a special use case, I think it should be implemented on the application side rather than as an API.

One possible implementation would be to check the position of each node in the render API and add a button if it is the last node in the list.

Would the following sample be helpful? https://codesandbox.io/s/issue-120-jq2o7t?file=/src/App.tsx

Yes, that will do, thank you for your help.