Thanks Matt, that's what I ended up with but your example provides an even 
easier code sample for me to follow.

________________________________
From: Matt Priour [mailto:[email protected]]
Sent: November 16, 2010 12:34 PM
To: Andrew Stewart; [email protected]
Subject: Re: [Users] Problem With GeoExt.tree.LayerContainer loader

Sure, you can either make the filter function test more specific
ex: filter:function(record){return record.get('layer').name=="Monday"}
or if you really just want a single layer then, you should use a 'gx_layer' 
nodeType for a GeoExt.tree.LayerNode

ex: {text:'Monday',
   nodeType:'gx_layer',
   checked:true,
   layer:'Monday'}

layer needs to refer to either the layer name that you used when you created 
the OpenLayers.Layer instance or an actual layer object.
If you use a name for the layer attribute, & do not include a layerStore 
attribute, then the layer store will be infered from the MapPanel's layer store.

Matt Priour
Kestrel Computer Consulting

From: Andrew Stewart<mailto:[email protected]>
Sent: Tuesday, November 16, 2010 1:06 PM
To: [email protected]<mailto:[email protected]>
Subject: [Users] Problem With GeoExt.tree.LayerContainer loader

I am having a slight issue. What happens if you have 2 layers with similar 
names like one called Monday and the other called Monday Too. With my loader 
code below both layers would show up in my layertree evne though I only want 
the first one (Monday) to show, can it be modified so that it will match exact 
names of layers only? Appreciate any advice.

loader:
        {
            filter: function(record)
            {
                var myarr = new Array();
                myarr[0] = record.get("layer").name.indexOf("Monday");


                if(myarr[0]==-1)
                {
                return false;
                }
                else
                {
                return true;
                }
            }
            }
        });



________________________________
This e-mail is intended for the original recipient(s) only. If you have 
received it in error, please advise the sender and delete this message.

________________________________

_______________________________________________
Users mailing list
[email protected]
http://www.geoext.org/cgi-bin/mailman/listinfo/users

________________________________
[This message has been scanned for security content threats and viruses.]

[The City of Red Deer I.T. Services asks that you please consider the 
environment before printing this e-mail.]



_______________________________________________
Users mailing list
[email protected]
http://www.geoext.org/cgi-bin/mailman/listinfo/users

Reply via email to