PDA

View Full Version : Node and TreeNode ?



libertux
27 Nov 2007, 10:00 AM
Hi every body ;)

I try to affect a Node (Ext.data.Node) to the root of a treepanel i do :



......
......
var projectsNode = new Ext.data.Node({
id:'PrsNode',
text:'Orel Projects',
iconCls:'projects'
});
......
......

items:[{
id:'PsP',
title:'Projects Panel',
xtype: 'treepanel',
loader: new Ext.tree.TreeLoader({preloadChildren:true}),
rootVisible:true,
lines:true,
autoScroll:true,
root: projectsNode//<------ here the call of the NODE

},{
id:'PP',
title:'Project Panel'
}]



but i have this error :(( :



this.root.render is not a function
http://127.0.0.1/Orel/js/ext-all.js
Line 99


Any suggestion !!!
:D need help
THKS

new2ext
27 Nov 2007, 6:22 PM
Try the setRootNode function.

treeName.setRootNode(projectsNode);

aconran
2 Dec 2007, 12:20 AM
Use an Ext.tree.AsyncTreeNode instead of a Ext.data.Node for your root. TreePanel will automatically set the node as the root when it is passed in as a configuration option.

Animal
2 Dec 2007, 3:13 AM
Ext.data.Node is a utility class for representing tree structures in memory. It may be useful to use in some situations - it has all the useful traversal methods of DOM nodes.

But what you want to make a TreePanel is the Ext.tree.TreeNode which is a subclass of Ext.data.Node which can also render itself.