PDA

View Full Version : add node and expand GXT Async TreeGrid



mxhn
31 Mar 2011, 1:04 AM
Hi,

I've an Async TreeGrid that uses an RPC proxy to load data from server. I want to reload a node by using:

this.treeLoader.loadChildren(nodeModel);
Then, I want the loaded tree node to become expanded. I tried to:

treeGrid.setExpanded(nodeModel, true, false);
but the first call is asynchronous so the "setExpanded" happens before the nodes get loaded.

A solution would be to use a LoadListener on the treeLoader and expand the node after it's children are loaded but the listener's loaderLoad(..) method can't know directly the reason for the reload: maybe the user expanded a node and this triggered the reload or maybe the user clicked on a menu option to reload the node.

Is there any way to improve this so it's easier to trigger the node expand after the user wants to reload a node?

Thanks.