0

What is the best way to move the selected node on a TreeList. The TreeList will be a nested one without leaf nodes.

I tried to create an object of the selected node and append it to the parentNode

selectedNode[0].parentNode.parentNode.appendChild(newNode) and selectedNode[0].parentNode.parentNode.insertBefore(newNode, selectedNode[0].nextSibling);

But always the 'internalId' is undefined error comes up, im using 4.1 version of ext.

On previous versions i have seen var newNode = Ext.create('Ext.tree.TreeNode', {..});

Is there any alternative for this.

1 Answers1

0

This is how I'm adding a new node in 4.1:

// If no selection on the tree, the root node is the one we're adding to.
if ( ! this.selection )
    this.selection = this.panel.getRootNode();

// Create a new node record
var iNewRecord = this.selection.createNode({
    leaf:   false,
    loaded: true,        
});
Darin Kolev
  • 3,401
  • 13
  • 31
  • 46
Izhaki
  • 23,372
  • 9
  • 69
  • 107