View Full Version : ExtJS 3.0 TreePanel AsyncNode Loading JSon data infinite times at root node

7 Sep 2009, 9:39 PM
I have this issue with Ext.tree.TreePanel loading JSON data from a servlet using Ext.tree.TreeLoader.
Here is my javascript to create tree:
var treePanel = new Ext.tree.TreePanel( {
id : 'tree-panel1',
region : 'center',
margins : '2 2 0 2',
autoScroll : true,
rootVisible : true,
singleExpand : true,
loader : new Ext.tree.TreeLoader( {
method: 'Get',
dataUrl : '../catalog?'+query,
root : new Ext.tree.AsyncTreeNode()
treePanel.getSelectionModel().on('selectionchange', chageMyTree);
The servlet ("catalog") is returning data like this:

However, it creates the node infinite times for some reason. It keeps on creating infinite number of nodes once the page loads.
Do you think I m missing any configuration option.

7 Sep 2009, 11:25 PM
Yes, your node attributes should contain leaf:true.

8 Sep 2009, 2:40 AM
I have tried returning leaf:true as a node attribute, it still creates infinite nodes.
I tried returning following JSON string:
[{"text":"wqqwqw111","description":"aaaa","leaf":true,"url":"catalog.html?a=t&i=1","id":"1","edit":false}] .

8 Sep 2009, 2:59 AM
You are right, it needed leaf:true. My mistake was while creating JSON object at Java side.
Once I added it, I don't get infinite loop while rendering nodes.
Thanks a lot.