[OpenLayers-Users] Doing something when the layer's features get deleted

Adrian Popa adrian_gh.popa at romtelecom.ro
Fri Jul 16 11:35:33 EDT 2010


I managed to find this (and fix my problem) for myself - by using 
beforefeatureremoved event:

markers.events.on({
         "featureselected": onMarkerSelect,
         "featureunselected": onMarkerUnselect,
         "visibilitychanged": onMarkerToggle,
         "beforefeatureremoved": onMarkerBeforeFeatureRemoved
     });

function onMarkerBeforeFeatureRemoved(evt){
     if(evt.feature.popup){
         //kill the popup
         map.removePopup(evt.feature.popup);
         evt.feature.popup.destroy();
         delete evt.feature.popup;
     }
}

Now, the popups no longer remain stuck if the layer refreshes...

Thanks!

On 07/15/2010 05:36 PM, Adrian Popa wrote:
> Hello everyone,
>
> I have a problem with popups and a vector layer  - if I trigger a forced
> refresh on the vector layer while a popup for a feature is opening, the
> popup's div will freeze and I am unable to close it (most likely because
> the feature it was bound to gets deleted by the time the popup opens).
> Is there any way I can catch a signal/event for layer refresh (just
> before the layer's features get deleted) and abort/close the popup opening?
>
> Thanks,
> Adrian
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>    





More information about the Users mailing list