[Users] removing a popup window from a map
Vince Lotito
vince at vvl.com
Wed Feb 17 06:24:51 CET 2010
Hello,
I am building a popup window for a map feature unsing GeoExt.Popup as follows:
if (! (pin in popupCache)) {
// create it
popup = new GeoExt.Popup({
title: pin,
layout: "accordion",
anchored: true,
feature: e.feature,
map: map,
lonlat: map.getLonLatFromPixel(new OpenLayers.Pixel(e.xy.x, e.xy.y)),
width:250,
html: html,
autoScroll: true,
collapsible: true,
// add a listener to capture a close event
listeners: {
close: (function (pin) {
return function (panel) {
delete popupCache[pin]; // remove it from the cache
};
})(pin),
scope: this
}
});
popup.show();
popupCache[pin] = popup;
}
I am using a popCache to limit feature popups to 1 popup window per pin (associated with a parcel) and global close on all popups. I am using the following function to remove all popups from the map:
for (pin in popupCache) {
popup = popupCache[pin];
popup.close();
}
This works fine for all popups that are in visible extent, however it does nothing to other popup windows that are not visible in the extent but associated with the map. How can I force close all popups on the map/map panel regardless of the extent viewed?
Any help is greatly appreciated.
Vince
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20100216/0dd151a2/attachment.htm
More information about the Users
mailing list