[Users] Different layer containers in a single layer tree

Luís de Sousa luis.a.de.sousa at gmail.com
Wed Mar 14 16:12:08 CET 2012


Dear all,

I'm trying to code a layer tree with two containers: one for base
layers and another for overlays. Using the code that goes below I'm
getting two containers but both are listing all the layers. Besides
this, the containers are listed inside an additional node in the three
without a name. What am I doing wrong?

Thank you for the help,

Luís

######################################################################

var baseLayerList = new GeoExt.tree.LayerContainer({
	    text: 'Base Layers',
	    layerStore: mapPanel.layers,
	    leaf: false,
	    expanded: true,
	    nodeType:'gx_baselayercontainer',
	});
	
	var overlayList = new GeoExt.tree.LayerContainer({
	    text: 'Overlays',
	    layerStore: mapPanel.layers,
	    expanded: true,
	    nodeType:'gx_overlaylayercontainer',
	});
	
	var treeRoot = new Ext.tree.AsyncTreeNode({
        expanded: true,
        children: [
            baseLayerList,
            overlayList
        ]
      });
	
	var layerTree = new Ext.tree.TreePanel({
	    title: 'Map Layers',
	    root: treeRoot,
	    region: "east",
	    width: 170,
        collapsible: true,
        autoScroll: true,
        enableDD: true,
	});


More information about the Users mailing list