[Users] Add layer to specific treenode id
Robert Buckley
robertdbuckley at yahoo.com
Sat Jan 15 09:18:51 CET 2011
Hi,
I have a grid containing the layers in the getcapabilities doc.
There is a button in the grid add the selected layer to the map. I would like to
add the layers to a node with the id "MyLayers".
this is the code to add the layer to the map from the grid.
mapPanel.layers.add(clone);
var bounds = new OpenLayers.Bounds.fromArray(clone.get("llbbox"))
bounds.transform(epsg4326, map.getProjectionObject());
map.zoomToExtent(bounds)
If I add this variable identifying the node to which the layer should be add I
should be able to somehow add the new layer as a child.
the container for the new layer is already in the tree..
layerRoot.appendChild(new GeoExt.tree.OverlayLayerContainer({
id: 'MyLayers',
text: "<span class='TreeHeader'>My Layers</span>",
layerStore: mylayers_store,
expanded: false
})
);
var MyLayersNode = tree.getNodeById('MyLayer');
I´m not really sure how to ensure that the layers added from the grid ONLY get
added the the treenode with the id "Mylayers". At the moment the clone is
getting added to all children in the tree!
Could anyone please direct me to the solution?
thanks
Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20110115/e3aa816b/attachment.htm
More information about the Users
mailing list