[Users] Question on layertree filter, can't filter indexOf properly

Andrew Stewart Andrew.Stewart at reddeer.ca
Tue Sep 7 23:30:35 CEST 2010


I am having a slight issue with my below code. I am trying to filter based on the name of my Layer so that only specific layers will appear in my layertree/layercontainer. I have a problem because I have two layers, one is called Rural Block Line and the other is called simply Block Line. My problem is since I am adding the layer using a loader/filter function that says -

myarr[1] = record.get("layer").name.indexOf("Rural Block Line");

if(myarr[0]==-1 && myarr[1]==-1 )

{

return false;

}

else

{

return true;

}



This not only gets the layer called Rural Block Line but also Block Line, which I do not want. Is there any other way I can rewrite this filter so that it matches my name exactly or do I have to go through everything and change names so that nothing has a similar name? Appreciate any assistance and hope I was clear about my issue.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20100907/c5e3acf1/attachment.htm 


More information about the Users mailing list