[Users] How to remove layer by name

Matt Priour mpriour at kestrelcomputer.com
Wed Aug 31 21:58:58 CEST 2011


vm is an array
map.removeLayer only takes a single layer argument
Matt Priour

From: Robert Buckley 
Sent: Wednesday, August 31, 2011 2:40 PM
To: users at geoext.org 
Subject: [Users] How to remove layer by name

Hi,

I thought this would be easy, but i´m stuck.


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.



handler: function(){
vm = map.getLayersByName("Results");
if (vm.length === 0) {
Ext.Msg.alert('Error', 'no search initiated');
}else
{
mappanel.map.removeLayer(vm);
}
}


Chrome reports:Uncaught Error: NOT_FOUND_ERR: DOM Exception 8






cheers for any help,


Rob


--------------------------------------------------------------------------------
_______________________________________________
Users mailing list
Users at geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20110831/79d7f86a/attachment.htm 


More information about the Users mailing list