PDA

View Full Version : Add nodes to an not existing Tree and Render it ...



DeDarling
23 Nov 2010, 3:40 AM
Hi,
id like to Discuss my new biggest ExtJs Problem :-)

I declare an TreePanel with a Root Node and none Child Nodes.

Then i add some Nodes programaticalliy to this node and render the node to the Page ... in debug i see the child Nodes but on Page they arent there :-(


var tree1 = new Ext.tree.TreePanel({
title: 'My Task List',
width: 220,
useArrows:true,
autoScroll:true,
animate:true,
enableDD:false,
containerScroll: true,
rootVisible: true,
frame: true,
root: {
text: 'Ausgewählte Merkmale'
}
});

tree.getRootNode().eachChild(function(node){
if(node.attributes.istTeilselektiert == 1){

tree1.getRootNode().appendChild(node.text);

node.eachChild(function(node2){
if (node2.attributes.checked == true){
tree1.getRootNode().findChild('text', node.text).appendChild(node2.text);
}
});
}

});

formpanel_uebersicht.add(tree1);
formpanel_uebersicht.doLayout();

Whats my fault ?

Condor
23 Nov 2010, 4:01 AM
Your root node is an AsyncTreeNode that will destroy all existing children and try to load when expanded.

Try specifying nodeType:'node' in your root node.

DeDarling
23 Nov 2010, 4:25 AM
Ok Thx .. this works for the Child Node of the Root Node


but i have also root -> childnode -> childnode

Expanding the Root Node works fine .. all ChildNode are displayed ... but when i now expand the childnode of the root child node i have an endless loading circle ?!?!

Condor
23 Nov 2010, 4:32 AM
Add proper TreeNodes, e.g.

tree1.getRootNode().appendChild({
nodeType: 'node',
text: node.text
});

DeDarling
23 Nov 2010, 4:49 AM
Yehaa :-)

Thx !! It Works !