[Users] LayerContainer in TreePanel

Matt Priour mpriour at kestrelcomputer.com
Tue Mar 2 15:18:09 CET 2010


Julien,
Your method works fine. You would just change the root config to this
...
root:{
nodeType:'async',
children:[layerListTasmania,layerListUS]
...

alternatively you can use an async node for the parent of both the 
layerListTasmania & layerListUS in the treeConfig.
Since you are using filter functions, you have to define the treeConfig 
directly rather than round-tripping it through the JSON reader/writer.

ex:
...
{nodeType:'async',
children:[{
      text: 'Tasmania Layers',
      layerStore: mapPanel.layers,
      leaf: false,
      expanded: true,
      nodeType:'gx_overlaylayercontainer',
      loader: {
          filter: function(record) {
              return record.get("layer").name.indexOf("Tasmania") !== -1
          }
      }
 },
{
      text: 'US Layers',
      layerStore: mapPanel.layers,
      leaf: false,
      expanded: true,
      nodeType:'gx_overlaylayercontainer',
      loader: {
          filter: function(record) {
              return record.get("layer").name.indexOf("US") !== -1
          }
      }
 }]
}
...

Matt Priour
Kestrel Computer Consulting

--------------------------------------------------
From: "Eric Lemoine" <eric.lemoine at camptocamp.com>
Sent: Tuesday, March 02, 2010 1:19 AM
To: "Julien-Samuel Lacroix" <jlacroix at mapgears.com>
Cc: <users at geoext.org>
Subject: Re: [Users] LayerContainer in TreePanel

> On Monday, March 1, 2010, Julien-Samuel Lacroix <jlacroix at mapgears.com> 
> wrote:
>> Hi,
>>
>> I was looking at the Layer Tree Tutorial [1] and wondered if it's
>> possible to add multiple LayerContainer to a single TreePanel.
>>
>> For example, how do I build a Tree with the two following LayerContainer:
>>
>> var layerListTasmania = new GeoExt.tree.LayerContainer({
>>      text: 'Tasmania Layers',
>>      layerStore: mapPanel.layers,
>>      leaf: false,
>>      expanded: true,
>>      loader: {
>>          filter: function(record) {
>>              return record.get("layer").name.indexOf("Tasmania") !== -1
>>          }
>>      }
>> });
>>
>> var layerListUS = new GeoExt.tree.LayerContainer({
>>      text: 'Tasmania Layers',
>>      layerStore: mapPanel.layers,
>>      leaf: false,
>>      expanded: true,
>>      loader: {
>>          filter: function(record) {
>>              return record.get("layer").name.indexOf("US") !== -1
>>          }
>>      }
>> });
>
>
> Hi Julien. I think it should work. Do you have trouble making it work?
>
> Cheers,
>
> -- 
> Eric Lemoine
>
> Camptocamp France SAS
> Savoie Technolac, BP 352
> 73377 Le Bourget du Lac, Cedex
>
> Tel : 00 33 4 79 44 44 96
> Mail : eric.lemoine at camptocamp.com
> http://www.camptocamp.com
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
> 


More information about the Users mailing list