PDA

View Full Version : Hide some node when tree is render?what event should I fire on the tree?



cecol
23 Aug 2007, 7:25 PM
My tree is load asyn.I want to hide some node base condition.what event should i frie on the tree?I have test beforeappend,beforeexpand ,beforechildrenrendered ;but all does'nt work.
my code is

tree.on('beforeexpand',function(treePanel,parent,node){
if(node.attributes.qtip == 'disable'){
node.getUI().hide();
}
});

cecol
23 Aug 2007, 7:35 PM
The last code my post is wrong.the current code is

tree.on('append',function(tree,parent,node,index ){
if(node.attributes.qtip == 'disable'){
//child.getUI().rendered = true;
alert(node.getUI().rendered);

node.getUI().hide();
}
});
why a node is appended ,but node.getUI().rendered is false?
when the node.getUI().rendered is true?

cecol
24 Aug 2007, 3:16 AM
Can anyone help me?thanks
It puzzle me some days!

Animal
24 Aug 2007, 4:46 AM
You can append a node, but it won't be rendered (The UI created) until it's needed. That is until its parent is expanded. No point in creating UI elements if nobody is looking!

I'd add an "expand" listener to a parent node which would loop through all its child nodes, hiding them if needed.

cecol
25 Aug 2007, 8:29 PM
Thanks very much,animal!
I have fix it.