minop1205 / react-dnd-treeview

A draggable / droppable React-based treeview component. You can use render props to create each node freely.
MIT License
516 stars 69 forks source link

Add multiple new node at once. #209

Closed nilesh2b closed 3 months ago

nilesh2b commented 10 months ago

@minop1205 I have been using this package from very long time and found very useful.

Can we add multiple nodes using dropdown list of nodes which will come from an API in the popup box of add new node?

minop1205 commented 10 months ago

@nilesh2b Yes, it is possible. No special method is needed, it should be possible by simply passing a new array to the tree property.

How you merge tree items is up to your application.

const newItems = [...oldItems, ...newItems];

<Tree tree={newItems} {. .otherProps} /> 
nilesh2b commented 10 months ago

@minop1205 Thanks again. I will apply this method and check.