[Users] How to add layers to LayerContainer?

Adam Ratcliffe adam at prema.co.nz
Thu Aug 5 12:06:06 CEST 2010


Typically the steps would be these:

1) Create an instance of OpenLayers.Map
2) Create a GeoExt.MapPanel instance, passing it a reference to the map you created in step 1)
3) Create an instance of GeoExt.tree.LayerContainer, setting it's "layerStore" config property to the "layers" property of the map panel created in step 2)

A GeoExt.data.LayerStore is implicitly created when you add the map to the map panel.  The layer store listens to the map's layer events and updates it's state accordingly therefore you can now add new layers to the map and nodes will be created for them by the tree panel which is bound to the layer store.

An example can be seen here: http://dev.geoext.org/trunk/geoext/examples/layercontainer.html

Cheers
Adam

On 5/08/2010, at 7:28 PM, Mehmet Sirin wrote:

> Hi, maybe you can help me adding a layer to a LayerContainer after  i have added this container to a TreePanel with some initial grouped layers ?
> 
> After the site is loaded I can add a LayerContainer to the layer-list of the TreePanel via: layerTree.getRootNode().appendChild(myLayerContainer);
> But as I said I don't know how to append a single layer to myLayerContainer..
> 
> 
> Thank you in advance for helping :)
> 
> bye
> 
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users



More information about the Users mailing list