PDA

View Full Version : XmlTreeLoader error



jpnet
15 Aug 2008, 8:11 AM
The following is a snippet of code that I have:



var tree = new Ext.tree.TreePanel();
tree.root = new Ext.tree.AsyncTreeNode();
tree.loader = new Ext.ux.XmlTreeLoader({dataUrl: 'javascripts/config/NavigationTree.xml'});

ewa_navPanel.add(tree);

tree.render();


ewa_navPanel is just an Ext.Panel. The problem is the tree does not render and I get an error "ct is undefined in ext-all-debug.js" on line 15916. I'm sure it's something I'm doing wrong... I have looked at the example and have tried to adapt it to my code and this is what I have come up with.

A couple of other notes:
1) I'm using Ext 2.2.
2) I have included the Ext.tree.XmlTreeLoader code.

Thanks in advance for any help.

-JP

jpnet
15 Aug 2008, 8:17 AM
I should note the typo in #2. I meant to say I have included the "Ext.ux.XmlTreeLoader" code and not "Ext.tree.XmlTreeLoader" code.

jpnet
15 Aug 2008, 10:36 AM
Does anyone have any thoughts as to why this error might be occurring? Thanks again.

-JP

jpnet
15 Aug 2008, 12:39 PM
I have adapted my code from Saki's example... http://blog.extjs.eu/know-how/how-to-build-a-tree-from-static-data/

However, I don't get any errors anymore and the root node of the tree renders. The problem is, the child nodes do not render or show up. Any thoughts as to why this might be??

Thanks.




var children = [{
text:'First Level Child 1'
,children:[{
text:'Second Level Child 1'
,leaf:true
},{
text:'Second Level Child 2'
,leaf:true
}]
},{
text:'First Level Child 2'
,children:[{
text:'Second Level Child 1'
,leaf:true
},{
text:'Second Level Child 2'
,leaf:true
}]

}];


var tree = new Ext.tree.TreePanel({
loader: new Ext.tree.TreeLoader(),
root: new Ext.tree.AsyncTreeNode({
leaf:false
,loaded:true
,expanded:true
,text:'Tree Root'
,children:children
}),

renderTo: Ext.getBody(),
//rootVisible: false,
autoScroll: true
});

tree.render();

ewa_navPanel.add(tree);


-JP