[Users] Question on multiple filters for a LayerContainer control
Andrew Stewart
Andrew.Stewart at reddeer.ca
Wed Sep 1 17:11:07 CEST 2010
Thanks a lot, that is exactly what I needed! :)
________________________________
From: users-bounces at geoext.org [mailto:users-bounces at geoext.org] On Behalf Of Ryan Williams
Sent: September 01, 2010 8:59 AM
To: users at geoext.org
Subject: Re: [Users] Question on multiple filters for a LayerContainer control
We had a similar challenge here, one of our web programmers helped me figure this out.
In this situation, I wanted all layers with a name that did NOT include "Balance", "Ratio", or "Highlight" to appear in this layercontainer:
loader: {
filter: function(record) {
var myarr = new Array();
myarr[0]=record.get("layer").name.indexOf("Balance");
myarr[1]=record.get("layer").name.indexOf("Ratio");
myarr[2]=record.get("layer").name.indexOf("Highlight");
if(myarr[0]==-1 && myarr[1]==-1 && myarr[2]==-1){
return true;
}else{
return false;
}
}
Not sure if it's THE best solution, but it does work and it's fairly simple to add additional words to search for.
Hope this helps,
Ryan
On 9/1/2010 9:49 AM, Andrew Stewart wrote:
I am faily new to GeoExt and openlayers. What I am trying to do is add multiple filters to a layercontainer so that I can add multiple layers to each group. Not sure if this is the best way to do this but what I want to do is add all my Street Labels to a group called "Labels" I can add one no problem called Overview Streets with the following code, but I need to add additional layers like one called Quadrant Streets. When I try to modify the filter code to add additional names it doesn't work and I get javascript errors. Any help appreciated!
//Define Layer List Control - Tree Control for Legend Control
var layerList_Labels = new GeoExt.tree.LayerContainer({
text: 'Labels',
layerStore: mapPanel.layers,
leaf: false,
expanded: false,
loader: {
filter: function(record) {
return record.get("layer").name.indexOf("Overview Streets") !== -1 (need to add Quadrant Streets here also)
}
}
});
________________________________
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
Users at geoext.org<mailto:Users at geoext.org>
http://www.geoext.org/cgi-bin/mailman/listinfo/users
--
Ryan Williams, GISP
GIS Analyst / Programmer
PAQ Interactive Inc.
107 S State St., Suite 300
Monticello, IL 61856-1968
________________________________
[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.]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20100901/f3c5a3ed/attachment-0001.htm
More information about the Users
mailing list