View Full Version : Loading TreePanel from a data store

6 Nov 2009, 3:18 PM
Hello expets,
Here is the scenario, I have a data store that has a proxy to make ajax call to load some data from the server, and I want to show this data in a treePanel.
so I added a store listener to the "load" event to trigger a function that reads the store and adds its data to the tree.
for some reason, in firebug I see that the tree has 5 items, but when I expand the tree I get the spinning icon but the tree never loads.

please help

here the code:

Cat.ZoneTree = Ext.extend(Ext.tree.TreePanel, {
initComponent: function() {

// add Store Listener
this.zoneStore.on('load', function(){
}, this);

Cat.ZoneTree.superclass.initComponent.apply(this, arguments);
loadTreeData : function(){
var treeChildren = [];
// create a tree item
var zone = {
text: record.get('name'),
iconCls: 'zone-icon',
children: [],
zone: record
// add the item to the array
}, this);

// add the array of items to the tree
useArrows: true,
autoScroll: true,
loader: new Ext.tree.TreeLoader({preloadChildren: true}),
root: {
text: 'Dashboard',
iconCls: 'world-icon',
dashboard: true

Ext.reg('cb.tztree', Cat.ZoneTree);

6 Nov 2009, 4:59 PM
Make sure the spinning node has leaf property set to true (leaf=true)

6 Nov 2009, 5:10 PM
it's the root node, it can't be leaf:true, otherwise tree wouldn't expand

6 Nov 2009, 11:08 PM
Configure your root with nodeType:'node' (=TreeNode) or with loaded:true (= loaded AsyncTreeNode).

7 Nov 2009, 9:40 AM
Hi Condor,
I tried both nodeType:'node' and loaded:true, both made the tree un-expandable !!
any idea?

8 Nov 2009, 10:13 AM
any advice here please, I just need to load a tree using a data store

thank you