[Users] children in layertree not visible

Matt Priour mpriour at kestrelcomputer.com
Mon Nov 22 19:06:39 CET 2010


The most likely issue is that the layer parameter is not quite right.
If you are referencing a the variable name for layer then don't use quotes, if you are referencing the layer name then do use quotes and make sure that capitalization is correct.
ex:

var wmsLayer = new OpenLayers.Layer.WMS('wms',{layers:'layer1,layer2'},{buffer:0,isBaseLayer:false})

then using one of these configurations will work
{nodeType:'gx_layer',
layer : wmsLayer}

{nodeType:'gx_layer',
layer : 'wms'}

these however will not 
{nodeType:'gx_layer',
layer : 'wmsLayer'}

{nodeType:'gx_layer',
layer : 'WMS'}

Matt Priour
Kestrel Computer Consulting


From: Christian Gadge 
Sent: Monday, November 22, 2010 8:29 AM
To: users at geoext.org 
Subject: [Users] children in layertree not visible


Hi all,

until now I only used OpenLayers and GeoExt with the experience gained from several tutoials ;)
I created MapPanels and LayerTrees like this...

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

Now I tried to define a customized layerlist with sublayers and make them visible in map onClick:


var layerList =[{                                     "text":"Land use",                        "children":[{                            "nodeType":"gx_layer",                            "layer":"wms"                            },{                            "nodeType":"gx_layer",                            "layer":"MAS"                            },{                            "nodeType":"gx_layer",                            "layer":"MRS"                            }]                            },{                        "text":"Air quality and health",                        "children":[{                            "nodeType":"gx_layer",                            "layer":"wms2"                            },{                            "nodeType":"gx_layer",                            "layer":"GMAS"                            },{                            "nodeType":"gx_layer",                            "layer":"MRS"                            }]                                                      }]    ;   

var tree = new Ext.tree.TreePanel({
   		region:		'west',
    		title: 		"Layers",
    		width: 		200,
    		autoScroll: 	true,
    		enableDD: 	true,
    		lines: 		false,	
        	loader: 	new Ext.tree.TreeLoader({
            				applyLoader: false
        			}),
        	root: 		{
					children: layerList
       		 		},
        	rootVisible: 	true
    		});  

But only root and the first node are visible in LayerTree. The nodes are not expandable. 
What is missing in this definition?

The error message in Firebug shows:
this.node.layer.getVisibility is not a function


Best regards,
Christian



--------------------------------------------------------------------------------


_______________________________________________
Users mailing list
Users at geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20101122/8d11f430/attachment.htm 


More information about the Users mailing list