PDA

View Full Version : Need help with Tree



ender07
26 Sep 2008, 1:06 PM
Hello,

I am new to EXT and am having some problems with using Trees. In the code below, I am calling a url that is return a node that should be in json. However, the TreePanel, does not add this node. Instead it shows my root node entry twice? Any ideas on what could be wrong? Is there a different approach that I should be following?

thanks

Ext.onReady(function(){
// shorthand
var Tree = Ext.tree;

var tree = new Tree.TreePanel({
el:'tree-div',
useArrows:true,
autoScroll:true,
animate:true,
enableDD:true,
containerScroll: true,

// auto create TreeLoader
dataUrl: 'http://localhost:9080/webconsole/groupData.do',

root: {
nodeType: 'async',
text: 'Root (Group)',
draggable:false,
id:'source'
}
});

// render the tree
tree.render();
tree.getRootNode().expand();
});

Data that is returned by the server:
[{"id":"sam","leaf":false,"text":"20"}]