GeoExt BaseLayerContainer and OverlayLayerContainer together

If you want to use  GeoExt widgets BaseLayerContainer and OverlayLayerContainer in the same tree, like this:

geoext baselayer and overviewlayer containers

GeoExt BaseLayerContainer and OverlayLayerContainer

var layerRoot = new Ext.tree.TreeNode({
text: "All Layers",
expanded: true
});
layerRoot.appendChild(new GeoExt.tree.BaseLayerContainer({
text: "Base Layers",
map: map,
expanded: true
}));
layerRoot.appendChild(new GeoExt.tree.OverlayLayerContainer({
text: "Overlays",
map: map,
expanded: true
}));
var layerTree = new Ext.tree.TreePanel({
title: "Map Layers",
root: layerRoot,
enableDD: true,
collapsible: true,
height: 200,
expanded: true
});

GeoExt is now at 0.5RC1 and it is rather good!

About these ads

4 thoughts on “GeoExt BaseLayerContainer and OverlayLayerContainer together

  1. You are my idol, hours and hours thinking in what fails in the GeoExt´s example and know wiht a few lines, all working ok. How is posible to make a official tutorial so complicated?
    Thaks

  2. Hi,

    Your blog is really very helpful. I am a newbee in GIS development.
    I am facing a problem regarding GeoExt

    root: new GeoExt.tree.BaseLayerContainer({
    layerStore: mapPanel.layers,
    expanded: true
    }),

    root: new GeoExt.tree.OverlayLayerContainer({
    layerStore: mapPanel.layers,
    expanded: true
    }),

    rootVisible: true,
    lines: true,

    I am facing problem regarding making group in a tree.
    I don’t know what ‘root’ is doing here. So, using it both the cases. But I get only the ‘Overlays’ as group. ‘Base Layers’ as a group or individually are not visible any more.

    But I need both of them visible as a group in the tree.

    I followed your tutorial of this section. But may that doesn’t fit with my environment.
    Can you please help me in this regard?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s