[Users] removing a popup window from a map

Andreas Hocevar ahocevar at opengeo.org
Wed Feb 17 11:06:46 CET 2010


Hi,

you should use

mapPanel.remove(popup);

rather than

popup.close();

Regards,
Andreas.

On 2010-02-17 06:24, Vince Lotito wrote:
>
> 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
>
>  
>
>
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>   


-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.



More information about the Users mailing list