<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial, helvetica, sans-serif;font-size:12pt;color:#000000;"><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 12pt; ">Hi,</div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 12pt; "><br></div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 12pt; ">I thought this would be easy, but i´m stuck.</div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 12pt; "><br></div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 12pt; "><br></div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; 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="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 12pt; "><br></div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 12pt; "><br></div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 12pt; "><br></div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 12pt; "><div><span class="Apple-tab-span" style="white-space:pre">                                </span>handler: function(){</div><div><span class="Apple-tab-span" style="white-space:pre">                                                        </span>vm = map.getLayersByName("Results");</div><div><span class="Apple-tab-span" style="white-space:pre">                                                        </span></div><div><span class="Apple-tab-span" style="white-space:pre">                                                        </span>if (vm.length === 0) {</div><div><span class="Apple-tab-span" style="white-space:pre">                                                                </span>Ext.Msg.alert('Error', 'no search initiated');</div><div><span class="Apple-tab-span"
style="white-space:pre">                                                        </span>}else</div><div><span class="Apple-tab-span" style="white-space:pre">                                                        </span>{</div><div><span class="Apple-tab-span" style="white-space:pre">                                                                </span>mappanel.map.removeLayer(vm);</div><div><span class="Apple-tab-span" style="white-space:pre">                                                                </span></div><div><span class="Apple-tab-span" style="white-space:pre">                                                        </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                                                </span>}</div></div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 12pt; "><br></div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 12pt; "><br></div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 12pt; ">Chrome reports:<span class="Apple-style-span" style="color: rgb(255, 0, 0); font-family: Consolas, 'Lucida Console', monospace; font-size: 12px; line-height: 12px; white-space:
pre-wrap; ">Uncaught Error: NOT_FOUND_ERR: DOM Exception 8</span></div><div><font class="Apple-style-span" color="#ff0000" face="Consolas, 'Lucida Console', monospace"><span class="Apple-style-span" style="font-size: 12px; line-height: 12px; white-space: pre-wrap;"><br></span></font></div><div><font class="Apple-style-span" color="#ff0000" face="Consolas, 'Lucida Console', monospace"><span class="Apple-style-span" style="font-size: 12px; line-height: 12px; white-space: pre-wrap;"><br></span></font></div><div><font class="Apple-style-span" color="#ff0000" face="Consolas, 'Lucida Console', monospace"><span class="Apple-style-span" style="font-size: 12px; line-height: 12px; white-space: pre-wrap;"><br></span></font></div><div><font class="Apple-style-span" color="#ff0000" face="Consolas, 'Lucida Console', monospace"><span class="Apple-style-span" style="font-size: 12px; line-height: 12px; white-space: pre-wrap;">cheers for any
help,</span></font></div><div><font class="Apple-style-span" color="#ff0000" face="Consolas, 'Lucida Console', monospace"><span class="Apple-style-span" style="font-size: 12px; line-height: 12px; white-space: pre-wrap;"><br></span></font></div><div><font class="Apple-style-span" color="#ff0000" face="Consolas, 'Lucida Console', monospace"><span class="Apple-style-span" style="font-size: 12px; line-height: 12px; white-space: pre-wrap;">Rob</span></font></div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 12pt; position: fixed; "></div>
</div></body></html>