[Users] Dynamic Node does not bind to layer

IT Intern itintern12 at gmail.com
Mon Nov 29 19:38:52 CET 2010


Dear Matt,

Thanks for your feedback!  Unfortunately I have tried that and I still have
a little problem :-/.  When I remove the additional listener everything
works great, except every layer container on my tree now has a node for this
layer which is not what I want :(.  I need a way that I append a single node
to a single layer container ...

Thank you,

elshae

On Mon, Nov 29, 2010 at 1:33 PM, Matt Priour <mpriour at kestrelcomputer.com>wrote:

>  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 <itintern12 at gmail.com>
> *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/a939b241/attachment.htm 


More information about the Users mailing list