I am doing a map which refresh dinamically all markers when they get modified. I want to add popups to show some info.
I create popups this way:
var feature = new OpenLayers.Feature(markers, location); //location = lonlat
feature.closeBox = true;
feature.popupClass = OpenLayers.Class(OpenLayers.Popup.FramedCloud, {
'autoSize': true
});;
feature.data.popupContentHTML = "info";
feature.data.overflow = (false) ? "auto" : "hidden";
var markerClick = function (evt) {
if (this.popup == null) {
this.popup = this.createPopup(this.closeBox);
map.addPopup(this.popup);
this.popup.show();
} else {
this.popup.toggle();
}
currentPopup = this.popup;
OpenLayers.Event.stop(evt);
};
mark.events.register("mousedown", feature, markerClick);
Now, I have the problem about what to do if one of my markers update its info. How can I destroy the popup? (I will create other one) or how can I modifiy it? Can I access them using lonlat?
Sometimes, I want to delete all of them, is there a way to do that? like deleting a layer or something?