[Users] Layer Tree groups

Matt Priour mpriour at kestrelcomputer.com
Mon Nov 8 20:39:21 CET 2010


Getting closer...
var treeConfig = [ ... ]  (THIS is the treeConfig object I was referencing; 
I was talking about your local treeConfig variable)

here is what you want:

         var treeConfig = [
         {
             //layer: "catastro", - Don't put a layer here. It will just be 
ignored. The visible layer is determined by the order they are added to the 
map
             nodeType: "gx_baselayercontainer",
             expanded:true,
             text: "My Base Layers Title" //OPTIONAL - if you don't give it 
a text attribute then it will use a default value for the text of the base 
layers parent node
         },
         {
             nodeType: "gx_layer",
             text: "Labores 2010",
             layer: "labores_2010",
             isLeaf:false
             loader: {
               param: "LAYERS"
             }
         } ];

tree = new Ext.tree.TreePanel({
             border: true,
             region: "west",
             title: "Capas",
             width: 200,
             split: true,
             collapsible: true,
             root: {
                 nodeType: "async",
                 children: treeConfig
             }
         });

Matt Priour
Kestrel Computer Consulting


--------------------------------------------------
From: "antoniofacno" <antoniofcano at gmail.com>
Sent: Monday, November 08, 2010 12:56 PM
To: <users at geoext.org>
Subject: Re: [Users] Layer Tree groups

> On 08/11/10 19:08, Matt Priour wrote:
>> While the JSON editing function in
>> http://api.geoext.org/1.0/examples/tree.js allows people to play with
>> the example directly, it has also generated quite a bit of confusion.
>> First, there is no need to write your child node configurations to
>> JSON and then parse it back out of JSON.
>> Second, do you actually want to show the layers from the WMS that make
>> up your labores_2010  WMS Layer and give users the ability to turn
>> them on/off independtly?
>> If so, then you want to use a LayerParamLoader, if not then you want
>> to use the regular OverlayLayerContainerLoader or a gx_layer node with
>> no loader.
>>
>> Here is the code you would use for allowing individual selection of
>> the different labores_2010  layers
>> {
>>   nodeType: "gx_layer",
>>   text: "Labores 2010",
>>   layer: "labores_2010",
>>   isLeaf:false
>>   loader: {
>>      param: "LAYERS"
>>   }
>> // creates subnodes for the layers in the LAYERS param. If we assign
>> // a loader to a LayerNode and do not provide a loader class, a
>> // LayerParamLoader will be assumed.
>> }
>>
>> Here is the code you would use for a single node to turn on/off the
>> labores_2010 layer
>> {
>>   nodeType: "gx_layer",
>>   text: "Labores 2010",
>>   layer: "labores_2010",
>>   isLeaf: true,
>>   checked: true
>> }
>>
>> Here is the code to use an OverlayLayerContainerLoader. This will
>> create subnodes for each non-baseLayer that has
>> 'displayInLayerSwitcher' == true (the default for the layer, unless
>> you specifically set it false in the layer options). It will use each
>> layer's name attribute as the text for the tree node.
>> {
>>   nodeType:'gx_overlaylayercontainer',
>>   expanded:true,
>>   loader:{
>>      baseAttrs:{checked:true} //this gives the overlayer layers
>> checkboxes
>>   }
>> }
>>
>> Get rid of the OpenLayers.Format.JSON write & parse stuff and just use
>> treeConfig object directly.
>>
> I think that I understand the JSON stuff, but the treeConfig object not
> at all. Is that what I have to wrote?
>
>         var treeConfig = [
>         {
>             layer: "catastro",
>             nodeType: "gx_baselayercontainer",
>         },
>         {
>             nodeType: "gx_layer",
>             text: "Labores 2010",
>             layer: "labores_2010",
>             isLeaf:false
>             loader: {
>               param: "LAYERS"
>             }
>         } ];
>
> I looking info for treeConfig Object but I don't find anything :(
>
> A lot of thanks,
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
> 


More information about the Users mailing list