[Dojo-interest] Re: Tree expand + RPCurl

Georges Villot gvillot at free.fr
Mon Dec 4 03:08:23 MST 2006


Vikas Sasidharan wrote:
> Hi,
> 
> Some off-the-cuff suggestions:
> 
> 1) Use the node.state attribute. At a time, a node will be exactly in
> one of the three states defined by the node.loadStates attribute. To
> quote the latter's doc (taken from TreeWithNode.js), "When an empty
> folder node appears, it is UNCHECKED first, then after Rpc call it
> becomes LOADING and, finally LOADED". So, you might be able to do
> something like:
> 
> if(firstLevelNode.state == firstLevelNode.loadStates.LOADED) {
> 	// go ahead and load the second level nodes.
> }
> 
> I think this approach should be fine, since the TreeLoadingControllerV3
> also uses the same approach internally (in its loadIfNeeded(...)
> function).
> 
> 2) May be this sounds dumb, but if you *have* to wait till the nodes get
> loaded (i.e. your processing is blocked till then) then why don't you as
> well change the call to a synchronous one (using
> controller.expandToLevel (..., ..., true))?
> 
> Rgds,
> Vikas

Hi Vikas,

thanks for your help.
the synchronous controller using expandToLevel method is only available 
for the TreeV3, and I was using the Tree object.
By upgrading it, it works like a charm.

thanks again for your hints,
georges
> 
> -----Original Message-----
> From: dojo-interest-bounces at dojotoolkit.org
> [mailto:dojo-interest-bounces at dojotoolkit.org] On Behalf Of Georges
> Villot
> Sent: Wednesday, November 29, 2006 6:20 AM
> To: dojo-interest at dojotoolkit.org
> Subject: [Dojo-interest] Tree expand + RPCurl
> 
> Hi,
> 
> I'm trying to implement a stateful tree using RPCurl.
> The tree works fine: the first layer is populated programmatically and 
> expanded. I would like to expand the second layer for some nodes and 
> haven't found a way to wait for the first layer to be populated before 
> expanding nodes at the second layer as it is done in a asynchronous way:
> 
> the first layer nodes cannot be found.
> 
> Is there a way to do it ?
> 
> thank you in advance for all
> georges.
> 
> _______________________________________________
> Dojo FAQ: http://dojo.jot.com/FAQ
> Dojo Book: http://manual.dojotoolkit.org/DojoDotBook
> Dojo-interest at dojotoolkit.org
> http://dojotoolkit.org/mailman/listinfo/dojo-interest
> _______________________________________________
> Dojo FAQ: http://dojo.jot.com/FAQ
> Dojo Book: http://manual.dojotoolkit.org/DojoDotBook
> Dojo-interest at dojotoolkit.org
> http://dojotoolkit.org/mailman/listinfo/dojo-interest
> 



More information about the Dojo-interest mailing list