[Users] Dynamic Node does not bind to layer

Matt Priour mpriour at kestrelcomputer.com
Mon Nov 29 19:33:51 CET 2010


The LayerStore associtated with the map already has register listeners in the map to take care of adding layers to itself when you add them to the map or vice versa.
Remove the additional listener that you are adding and things should work much better.

Matt Priour


From: IT Intern 
Sent: Monday, November 29, 2010 12:28 PM
To: users at geoext.org 
Subject: [Users] Dynamic Node does not bind to layer


Hello GeoExt list,

I have a tree panel which I append a child node to after it has been created.  The node appears, but when it is toggled on and off I get the error in firebug:


this.node.getOwnerTree() is null
 var checkedNodes = this.node.getOwnerTree().getChecked();

Also the layer does not appear on and off as the node is toggled.  I have tried several things, last thing I tried is listening to the event of where the map has added the layer and then adding the layer to the layer store and creating the node and appending it to the root node of the tree panel.  Please if anyone knows why this is failing please drop me a hint :)

Thanks,

elshae


    
    map.events.register("addlayer", this, function() {
        var l = map.layers[map.layers.length-1];
        layerStore.loadData([l], true);
        var className = '';
        if (l.isBaseLayer || !l.displayInLayerSwitcher) {
            className = 'x-hidden';
        }
      
        var node = new GeoExt.tree.LayerNode({
            layerStore: layerStore,
            layer: l,
            checkedGroup: 'foo',
            checked: false
        });
        // todo, depends on ascending whether to use insertBefore or appendChild
        //this.getRootNode().insertBefore(node, this.getRootNode().firstChild); 
        layerRoot.getOwnerTree().getNodeById('photos').appendChild(node);
        });

map.addLayer(vectorPano);



--------------------------------------------------------------------------------


_______________________________________________
Users mailing list
Users at geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20101129/b327e81f/attachment.htm 


More information about the Users mailing list