PDA

View Full Version : Is there an event for all children rendered in AsyncTreeNode?



erizvi
8 Sep 2010, 7:10 AM
Hi,

I have a page with radio button group on the top and a TreePanel below it. Upon selectionchange of the radio button group, I reload the rootNode (which is an AsyncRootNode) with a different id.


tree.getRootNode().id = newID;
tree.getRootNode().reload();

The problem is that when the user changes selection quickly I get an error:"this.getOwnerTree() is null or not an object".

Ideally I would like to reload the TreeNode once the current loading and rendering is complete, but I couldn't get it to work. So what I am doing is disabling the radio button group upon selectionchange and would like to enable it when all the children and grandchildren of the rootNode have been loaded and rendered. The 'load' event of AsyncTreeNode does not work if the children have children.

Animal
8 Sep 2010, 7:13 AM
1st param to reload.

erizvi
8 Sep 2010, 8:08 AM
Thanks Animal for the quick reply. I'm really sorry I don't understand what you mean by "1st param to reload." I'm new to Ext JS, so please bear with me.

Thanks

Animal
8 Sep 2010, 10:03 AM
You call reload there.

What do the docs say?

erizvi
8 Sep 2010, 10:49 AM
Ok, I get that now.

tree.getRootNode.reload(function(){ // enable radio button group});
However, the call back function never gets executed when the root node has great grand child nodes(depth = 3) and the radio buttons are enabled before the entire tree is rendered, which allows user to make another selection while the tree is in the midst of rendering, causing "this.getOwnerTree() is null or not an object" error to appear. Is there a way to call a function once the entire AsyncTreeNode ( the Entire tree (all the childrens)) is done rendering?

Thanks

darthwes
8 Sep 2010, 10:52 AM
Is there a way to call a function once the entire AsyncTreeNode ( the Entire tree (all the childrens)) is done rendering?



tree.on('afterrender', fn);

Animal
8 Sep 2010, 11:23 AM
That's not right. Component rendering is different.

I don't understand the OP's problem.