[Users] Dynamic Node does not bind to layer

IT Intern itintern12 at gmail.com
Mon Nov 29 19:28:42 CET 2010


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);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20101129/49c4e257/attachment-0001.htm 


More information about the Users mailing list