[Users] How to remove layer by name

Robert Buckley robertdbuckley at yahoo.com
Wed Aug 31 21:40:46 CEST 2011


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20110831/f846a81f/attachment.htm 


More information about the Users mailing list