PDA

View Full Version : TreePanel hide expand arrow



mck89
23 Apr 2010, 5:27 AM
Hi, i have a TreePanel that loads its data from an url and the json response contains everything including children of each node so it doesn't have to do other ajax requests. I want that every node in the tree can contain other children so i haven't set any "leaf" node. The problem is that the TreePanel shows an "expand" arrow on empty nodes too.
I think that this happens beacause children are not loaded immediatly so i have set to true the preloadChildren property on the TreeLoader but it doesn't do anything.
So is there a way to load every node immediatly? Or is there a property that i can set on the node to let Ext know that this node is empty?

Here is my code:

var categoriesTree=new Ext.tree.TreePanel({
useArrows:true,
autoScroll:true,
animate:true,
containerScroll:true,
border:false,
enableDD: true,
loader:new Ext.tree.TreeLoader({
dataUrl:"index.php",
preloadChildren:true
}),
root:{
nodeType:"async",
text:"Catalog",
id:"0"
}
});

CrazyEnigma
23 Apr 2010, 6:24 AM
If you know that the node does not contain any children, it would be best to set leaf: false

mck89
23 Apr 2010, 6:30 AM
I haven't set any leaf node beacuse if you do it you can't add any children to them