question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding elements to the tree

See original GitHub issue

Hello, I tested the demo with adding elements, everything works great.

But this addition works on the button. The task is this:

  1. There is a simple html tree without dnd
  2. There is your tree.
  3. I need to implement adding elements from the first tree to yours using dnd

The point of the idea is that there is no need to remove an element from the first tree. The first tree is like a set of features. When dragging a feature onto your tree, I need to figure out what level I’m at and add a new element based on the dragged feature.

How can this be implemented?

Is it possible to use the react-dnd library for the first tree, and when dragging onto your tree, I could understand to which level I dragged an element from the first list?

Or do I need to create a custom node and wrap it additionally in react-dnd?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
minop1205commented, Mar 4, 2022

Or is your tree unable to react in any way when something is dragged onto your tree?

That is correct. This is because at this time it is not possible to detect events when external elements are dragged.

0reactions
minop1205commented, Aug 25, 2022

I have released v3.0.0 today.

In this version, you can now drop elements outside the tree and drag & drop between trees.

See the README and samples for details.

README

https://github.com/minop1205/react-dnd-treeview#external-drag-source

Demo and Examples (Storybook)

https://minop1205.github.io/react-dnd-treeview/

(See stories below)

  • External element (inside react-dnd)
  • External element (outside react-dnd)
  • File drop
  • Text drop
  • Multiple tree
Read more comments on GitHub >

github_iconTop Results From Across the Web

Insertion in a Binary Tree in level order - GeeksforGeeks
Given a binary tree and a key, insert the key into the binary tree at the first position available in level order. Recommended:...
Read more >
Insertion(Adding a new Node) in a Binary Tree Data Structure
Step 1: Create a function to insert the given node and pass two arguments to it, the root node and the data to...
Read more >
Adding Elements to a Binary Search Tree - YouTube
0:03 - Algorithm for adding elements0:19 - Adding 7, 5, 6, 9, 3, & 8 to a BST1:05 - The shape of the...
Read more >
inserting a node in a binary search tree - Log2Base2
inserting a node in a binary search tree · 1. Create a new BST node and assign values to it. · 2. insert(node,...
Read more >
Insertion into a B-tree - Programiz
Inserting an element on a B-tree consists of two events: searching the appropriate node to insert the element and splitting the node if...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found