geoext / geoext2

GeoExt 2 — JavaScript Toolkit for Rich Web Mapping Applications
http://geoext.github.io/geoext2/
Other
142 stars 106 forks source link

destroying a layer and loading it... some help #360

Closed fobetor closed 9 years ago

fobetor commented 9 years ago

Hello I am having a problem about editing features. I dont know if it's about Openlayers or Geoext or both. Perhaps I am missing something. What I am doing is: a) Start an app with a WMS layer defined. All the stuff for the map etc.... It works ok b) Use buttons in Extjs/Geoext to define actions ie: Move a point, delete a point etc...Works fine c) When I click a button I want to replace the layer (lets call it wms_points) with other from a geoserver, so, I just: c.1) mappanel.map.removelayer("layerName"); c.2) destroy the layer c.3) redefine the layer wms_points= new OpenLayers.Layer.Vector ..... d) It appears in the tree as a new layer and the old one disappears, BUT WHEN I want to use the Move or delete buttons it seems that openlayers does not recognize the new points on the layers. If I try to get a popup, I recieve an error: "Uncaught Error: getFeatureFromEvent called on layer with no renderer. This usually means you destroyed a layer, but not some handler which is associated with it."

Well.. in any case, I am wondering if I have to "reload" the GeoExt buttons, the map, the viewport...? Clean something around? Clean and "restart" the actions?

Any help is appreciated. Best Fernando

marcjansen commented 9 years ago

This question is better asked on the mailinglist, together with some reproducible code or a fiddle. Thanks