[Users] How to get unrendered child nodes

Alessandro Pasotti apasotti at gmail.com
Wed Dec 8 10:38:37 CET 2010


2010/12/7 Alexandre Dube <adube at mapgears.com>

> There you go :
>
> http://dev.geoext.org/sandbox/mapgears/geoext.ux/ux/LayerTreeBuilder/examples/tree-builder.html
>
> Only added nodes are currently managed.  I still need to do some work
> for the removed nodes.
>


Hi,

thanks for sharing this useful component!!

I'm also working on a similar tree, I tested yours but since I use a lot of
GeoExt "magic" (a layer store and no explicit calls to map), the tree is not
automatically populated because the layerStore add event takes place before
the tree itself exists.

I had to add a listener to the tree, I'm not sure it is the preferred
method,  but maybe you want to add it to the code:

    // ABP: make sure tree is populated
    onAfterRender : function(self){
        // ABP: what if the store was already populated but the tree is
empty?
        if(! this.root.childNodes.length && this.layerStore.getRange() ){
            this.onLayerAdded(this.layerStore, this.layerStore.getRange(),
0);
        }
    },

... and in initComponent
        // ABP: add event handler
        this.on('afterrender', this.onAfterRender);


Another issue is with the checkboxes, it seems like unchecking a children,
unchecks the whole tree (upwards) even if a sibling is still checked.

The best option would be to have a tristate checkbox for partially checked
subtrees.


-- 
Alessandro Pasotti
w3:   www.itopen.it
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20101208/56151251/attachment-0001.htm 


More information about the Users mailing list