PDA

View Full Version : Tree appendChild to a dynamicaly created node



Urkman
26 Aug 2010, 2:39 AM
Hello,

I try to append a child to a dynamicaly created node, But I onlyget this error:


Ext.fly(node.ui.wrap) is null
[Break on this error] if (!Ext.fly(node.ui.wrap).isVisible() && selectNextNode) {

Here is the code I use to create the nodes:


nodeData = {
'placementId' : action.result.data.id,
'text' : 'new placement',
'type' : 'placement',
'iconCls' : 'icon-placement'
};

var node = new Ext.tree.TreeNode(nodeData);
node = this.selectedTreeItem.appendChild(node);

node.select();
this.selectedTreeItem = node;


When I first run this code everything is fine. But when I ran this code a second time, so it add the child to the previous generated node, I get the error...

Hope somebody can help me on this :-)

Greetings,
Urkman

Urkman
26 Aug 2010, 11:49 PM
Hello,

no one with an idea on this?

Greetings,
Urkman

Urkman
27 Aug 2010, 7:48 AM
Hello,

the fix is to expand the nodes.



nodeData = {
'placementId' : action.result.data.id,
'text' : 'new placement',
'type' : 'placement',
'iconCls' : 'icon-placement',
'expanded' : true
};


This fixes it. But why a node needs to be expanded to append a child?

Greetings,
Urkman