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.

Pass the TreeNode to the moveNode event

See original GitHub issue

So when moving nodes when drag/drop I want to check the level of the node. When the level is larger than 1 I don’t want it to be allowed to drag n drop.

I’m implementing this via the onMoveNode($event) but index always give back 0. Even if i go 4 levels deep or something.

plnkr from template:

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

KeithGillettecommented, Feb 22, 2018

I have had a similar issue. The to passed in the $event seems to be “detached” from the tree. My work-around has been to find the node in the treeModel & get its level or other properties from there:

/** TreeView mouse event handler */
public onTreeViewMoveNode(treeNodeMoveEvent: { eventName: string, node: any, to: { index: number, parent: any }, treeModel: TreeModel }): void {
	const parentTreeNode = ? undefined : treeNodeMoveEvent.treeModel.getNodeById(;
	const parentNodeLevel = parentTreeNode ? parentTreeNode.level : undefined;
	// Do something ...

eddieedeasecommented, Mar 14, 2018

Reopening for repoholder to see.

To summ it up: @adamkleingit : ' I think what could be helpful is to pass the TreeNode in addition to the node data - and then you can get the level.'

Read more comments on GitHub >

github_iconTop Results From Across the Web

WPF MVVM Treeview move node - Stack Overflow
my goal is to create a treeview with movable node. ... Handling UI events using commands inside the view model is an anti-pattern...
Read more >
Drag & Drop - Getting Started
It receives a TreeNode object, and should return a node object (only the data). ... moveNode events and get the moved node, and...
Read more >
TreeView.AfterCheck Event (System.Windows.Forms)
This code requires that you have a Form with a TreeView that has TreeNode objects in its TreeNodeCollection. The TreeNodeCollection should have tree...
Read more >
Properties, Methods and Events of ejTreeView Widget
The TreeView can be easily configured with the DOM element, ... except the hidden nodes then we need to pass excludeHiddenNodes as true...
Read more >
JSDoc: Widget: treeView
The original event is passed to the treeView#contextMenuAction ... See treeNodeAdapter#moveNodes, and treeNodeAdapter#copyNodes for how the ...
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 Post

No results found

github_iconTop Related Hashnode Post

No results found