Thanks for the answer!
The steps you describe is what i would do if i had no LayerContainers
that group several layer. And these LayerContainers are created
dynamically out of an xml-file. It looks like this:
<nameofGroup>
<layer1> <PointData / ><layer1 />
<layer2> <PointData / ><layer2 />
<layer3> <PointData / ><layer3 />
</nameOfGroup>
The layers are first added to the OpenLayers.Map object. Then i
iterate throug all groupNames and create LayerContainer that contains
all the three layers. Then after the site is loaded and i want to add
another group pushing a button which creates a single LayerContainer
and appends it to the TreePanel.
I just found out how to add another layer to the container, but now
have a problem:
var someLayer=new OpenLayers....
var myNewLayer= new GeoExt.tree.LayerNode({
layer: someLayer,
leaf: true,
expanded: true,
loader: {
baseAttrs: {
radioGroup: "foo",
uiProvider: "use_radio"
}
}
});
layerTree.getRootNode().findChild( "text","layerContainerName1"
).appendChild(myNewLayer);
The new appended myNewLayer is visible in the TreePanel and inside the
group-folder but it does not have a radiobutton like all the other
layers in the folder..
Anyone know how?
And maybe you have an idea how to do all the above described stuff in
a better way? In short i want:
-add new grouped layer containers to the tree panel (by clicking a button)
-add new layer to a certain layer-group in the tree panel (by clicking
a second button)
I would appecriate your help !
thank you
2010/8/5 Adam Ratcliffe <[email protected]>
>
> 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
> > [email protected]
> > http://www.geoext.org/cgi-bin/mailman/listinfo/users
>
_______________________________________________
Users mailing list
[email protected]
http://www.geoext.org/cgi-bin/mailman/listinfo/users