Hi,

if your legend is auto-created from a MapPanel's layers store, this
should not happen. If you build your legend manually, you have to
delete a layer's legend before you destroy the layer.

Andreas.

On Mon, Mar 5, 2012 at 5:12 PM, frank <fr...@spacetec.no> wrote:
> Dear list
>
> I'm using a self-made function for clearing all layers in my map and adding
> a stored set of predefined layers.
> In this routine i call map.removeLayer() for all non-base layers, before I
> add the new layer set.
>
> However, after having removed the layers I get an exception from
> GeoExt.VectorLegend:
>
> Uncaught TypeError: Cannot read property 'map' of null
>
> GeoExt.VectorLegend.Ext.extend.onMapZoomVectorLegend.js:261
> OpenLayers.Events.OpenLayers.Class.triggerEventEvents.js:798
> OpenLayers.Map.OpenLayers.Class.moveToMap.js:1890
> OpenLayers.Map.OpenLayers.Class.setCenterMap.js:1662
> OpenLayers.Control.Navigation.OpenLayers.Class.wheelChangeNavigation.js:279
> OpenLayers.Control.Navigation.OpenLayers.Class.wheelDownNavigation.js:303
> OpenLayers.Handler.OpenLayers.Class.callbackHandler.js:205
> OpenLayers.Handler.MouseWheel.OpenLayers.Class.wheelZoomMouseWheel.js:229
> OpenLayers.Handler.MouseWheel.OpenLayers.Class.onWheelEventMouseWheel.js:191
> (anonymous function)
>
> To the inner level this maps down to the function
>     onMapZoom: function() {
>             this.setCurrentScaleDenominator(
>                 this.layer.map.getScale()
>             );
>     },
>
> And by inspection this.layer is undefined.
>
> How can this be?
> Removing the layer with any combination of (one or both)
>     map.removeLayer(layer) and
>     layer.destroy()
> gives the same result.
>
> best regards,
> Frank
>
>
>
>
> _______________________________________________
> Users mailing list
> Users@geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
_______________________________________________
Users mailing list
Users@geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users

Reply via email to