<HTML><HEAD>
<STYLE type=text/css><!-- DIV {margin:0px;} --></STYLE>
</HEAD>
<BODY dir=ltr>
<DIV dir=ltr>
<DIV style="FONT-FAMILY: 'Arial'; COLOR: #000000; FONT-SIZE: 10pt">
<DIV>vm is an array</DIV>
<DIV>map.removeLayer only takes a single layer argument</DIV>
<DIV>Matt Priour</DIV>
<DIV
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none">
<DIV style="FONT: 10pt tahoma">
<DIV> </DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A title=robertdbuckley@yahoo.com
href="mailto:robertdbuckley@yahoo.com">Robert Buckley</A> </DIV>
<DIV><B>Sent:</B> Wednesday, August 31, 2011 2:40 PM</DIV>
<DIV><B>To:</B> <A title=users@geoext.org
href="mailto:users@geoext.org">users@geoext.org</A> </DIV>
<DIV><B>Subject:</B> [Users] How to remove layer by name</DIV></DIV></DIV>
<DIV> </DIV></DIV>
<DIV
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none">
<DIV
style="FONT-FAMILY: arial, helvetica, sans-serif; COLOR: #000000; FONT-SIZE: 12pt">
<DIV
style="FONT-FAMILY: arial, helvetica, sans-serif; COLOR: rgb(0,0,0); FONT-SIZE: 12pt">Hi,</DIV>
<DIV
style="FONT-FAMILY: arial, helvetica, sans-serif; COLOR: rgb(0,0,0); FONT-SIZE: 12pt"> </DIV>
<DIV
style="FONT-FAMILY: arial, helvetica, sans-serif; COLOR: rgb(0,0,0); FONT-SIZE: 12pt">I
thought this would be easy, but i´m stuck.</DIV>
<DIV
style="FONT-FAMILY: arial, helvetica, sans-serif; COLOR: rgb(0,0,0); FONT-SIZE: 12pt"> </DIV>
<DIV
style="FONT-FAMILY: arial, helvetica, sans-serif; COLOR: rgb(0,0,0); FONT-SIZE: 12pt"> </DIV>
<DIV
style="FONT-FAMILY: arial, helvetica, sans-serif; COLOR: rgb(0,0,0); FONT-SIZE: 12pt">I
want to remove a layer by it´s name..I thought this code would work as the first
part of the function works fine, but the remove function fails.</DIV>
<DIV
style="FONT-FAMILY: arial, helvetica, sans-serif; COLOR: rgb(0,0,0); FONT-SIZE: 12pt"> </DIV>
<DIV
style="FONT-FAMILY: arial, helvetica, sans-serif; COLOR: rgb(0,0,0); FONT-SIZE: 12pt"> </DIV>
<DIV
style="FONT-FAMILY: arial, helvetica, sans-serif; COLOR: rgb(0,0,0); FONT-SIZE: 12pt"> </DIV>
<DIV
style="FONT-FAMILY: arial, helvetica, sans-serif; COLOR: rgb(0,0,0); FONT-SIZE: 12pt">
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>handler:
function(){</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>vm =
map.getLayersByName("Results");</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN></DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>if (vm.length
=== 0) {</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>Ext.Msg.alert('Error', 'no search initiated');</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>}else</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>{</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"
class=Apple-tab-span></SPAN>mappanel.map.removeLayer(vm);</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN></DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>}</DIV>
<DIV><SPAN style="WHITE-SPACE: pre" class=Apple-tab-span></SPAN>}</DIV></DIV>
<DIV
style="FONT-FAMILY: arial, helvetica, sans-serif; COLOR: rgb(0,0,0); FONT-SIZE: 12pt"> </DIV>
<DIV
style="FONT-FAMILY: arial, helvetica, sans-serif; COLOR: rgb(0,0,0); FONT-SIZE: 12pt"> </DIV>
<DIV
style="FONT-FAMILY: arial, helvetica, sans-serif; COLOR: rgb(0,0,0); FONT-SIZE: 12pt">Chrome
reports:<SPAN
style="LINE-HEIGHT: 12px; FONT-FAMILY: consolas, 'Lucida Console', monospace; WHITE-SPACE: pre-wrap; COLOR: rgb(255,0,0); FONT-SIZE: 12px"
class=Apple-style-span>Uncaught Error: NOT_FOUND_ERR: DOM Exception
8</SPAN></DIV>
<DIV><FONT class=Apple-style-span color=#ff0000
face="Consolas, 'Lucida Console', monospace"><SPAN
style="LINE-HEIGHT: 12px; WHITE-SPACE: pre-wrap; FONT-SIZE: 12px"
class=Apple-style-span><BR></SPAN></FONT></DIV>
<DIV><FONT class=Apple-style-span color=#ff0000
face="Consolas, 'Lucida Console', monospace"><SPAN
style="LINE-HEIGHT: 12px; WHITE-SPACE: pre-wrap; FONT-SIZE: 12px"
class=Apple-style-span><BR></SPAN></FONT></DIV>
<DIV><FONT class=Apple-style-span color=#ff0000
face="Consolas, 'Lucida Console', monospace"><SPAN
style="LINE-HEIGHT: 12px; WHITE-SPACE: pre-wrap; FONT-SIZE: 12px"
class=Apple-style-span><BR></SPAN></FONT></DIV>
<DIV><FONT class=Apple-style-span color=#ff0000
face="Consolas, 'Lucida Console', monospace"><SPAN
style="LINE-HEIGHT: 12px; WHITE-SPACE: pre-wrap; FONT-SIZE: 12px"
class=Apple-style-span>cheers for any help,</SPAN></FONT></DIV>
<DIV><FONT class=Apple-style-span color=#ff0000
face="Consolas, 'Lucida Console', monospace"><SPAN
style="LINE-HEIGHT: 12px; WHITE-SPACE: pre-wrap; FONT-SIZE: 12px"
class=Apple-style-span><BR></SPAN></FONT></DIV>
<DIV><FONT class=Apple-style-span color=#ff0000
face="Consolas, 'Lucida Console', monospace"><SPAN
style="LINE-HEIGHT: 12px; WHITE-SPACE: pre-wrap; FONT-SIZE: 12px"
class=Apple-style-span>Rob</SPAN></FONT></DIV>
<DIV
style="POSITION: fixed; FONT-FAMILY: arial, helvetica, sans-serif; COLOR: rgb(0,0,0); FONT-SIZE: 12pt"></DIV></DIV>
<P>
<HR>
_______________________________________________<BR>Users mailing
list<BR>Users@geoext.org<BR>http://www.geoext.org/cgi-bin/mailman/listinfo/users<BR></DIV></DIV></DIV></BODY></HTML>