[Users] removing a popup window from a map
Vince Lotito
vince at vvl.com
Wed Feb 17 14:29:20 CET 2010
Hi,
Thank you for the quick response. I've added mapPanel.remove(popup) and now I am logging this error:
this.items is undefined
http://192.168.111.141/ext/ext-all.js
Line 64
Any ideas?
Vince
> -----Original Message-----
> From: users-bounces at geoext.org [mailto:users-bounces at geoext.org] On Behalf
> Of Andreas Hocevar
> Sent: Wednesday, February 17, 2010 5:07 AM
> To: users at geoext.org
> Subject: Re: [Users] removing a popup window from a map
>
> 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.
>
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
More information about the Users
mailing list