[Users] GeoExt Popup / GetFeatureInfo, how do I destroy the popup if it exists?
Matt Priour
mpriour at kestrelcomputer.com
Mon Sep 20 22:38:38 CEST 2010
I am also getting this error when using hover handler on WMSGFI control in OL 2.10 in IE
I think there is some bug in 2.10 related to this but I've not tested it enough.
Matt Priour
Kestrel Computer Consulting
From: Andrew Stewart
Sent: Monday, September 20, 2010 2:49 PM
To: 'Matt Priour' ; users at geoext.org
Subject: RE: [Users] GeoExt Popup / GetFeatureInfo, how do I destroy the popup if it exists?
Thanks for your suggestion, I tried to use your suggested code but I am getting a Javascript error after hovering over my layer, which states -
Message: Unspecified error.
Line: 1188
Char: 1
Code: 0
URI: http://localhost/WebServices/OpenLayers-2.10/OpenLayers.js
which is this line in OpenLayers.js but not sure exactly what's wrong. I do appreciate your assistance.
this._object.send(vData);if(bGecko&&!this._async){this.readyState=cXMLHttpRequest.OPENED;fSynchronizeValues(this);while(this.readyState<cXMLHttpRequest.DONE){this.readyState++;fReadyStateChange(this);if(this._aborted)
var info, infopop;
//Getfeatureinfo object
info = new OpenLayers.Control.WMSGetFeatureInfo({
url: 'http://ITS701X5J1/RedWMS/Request.aspx',
title: 'Identify features by clicking',
layers: [layer_Garbage_Zones],
queryVisible: true,
infoFormat: 'text/html',
maxFeatures: 1,
hover:true
});
info.events.on({
getfeatureinfo: function(e)
{
//get all existing popups
var popups = Ext.WindowMgr.getBy(function(win){return (win instanceof GeoExt.Popup)});
//kill all existing popups
popups.each(function(popup){popup.destroy()});
//<ADDED CODE - end>
infopop = new GeoExt.Popup({ //utilizing the GeoExt popup functionality
title: "Hotspot Information",
autoWidth: true,
autoHeight: true,
autoScroll: false,
map: map,
lonlat: map.getLonLatFromPixel(e.xy),
html: e.text
})
etext = e.text;
// if the hotspot information is empty (layer doesn't match) don't display!
if (etext.length == 45)
{
infopop.close();
}
else
{
infopop.show();
}
}});
map.addControl(info);
info.activate();
--------------------------------------------------------------------------------
From: Matt Priour [mailto:mpriour at kestrelcomputer.com]
Sent: September 20, 2010 1:39 PM
To: Andrew Stewart; users at geoext.org
Subject: Re: [Users] GeoExt Popup / GetFeatureInfo, how do I destroy the popup if it exists?
See added code below
Matt Priour
Kestrel Computer Consulting
From: Andrew Stewart
Sent: Monday, September 20, 2010 1:51 PM
To: 'users at geoext.org'
Subject: [Users] GeoExt Popup / GetFeatureInfo, how do I destroy the popup if it exists?
Below is my code for when I hover over a specific layer and the popup hotspot information is shown. I am trying to figure out how to only get one popup to show at a time so that I can show them like tooltips and destroy the existing one if another is shown. I have tried using if (infopop) or if (!infopop) but this doesn't seem to work in the way I have this coded. If anyone has any advice on how to destroy my popup when another is created thanks!
var info, infopop;
//Getfeatureinfo object
info = new OpenLayers.Control.WMSGetFeatureInfo({
url: 'http://ITS701X5J1/RedWMS/Request.aspx',
title: 'Identify features by clicking',
layers: [layer_Garbage_Zones],
queryVisible: true,
infoFormat: 'text/html',
maxFeatures: 1,
hover:true
});
info.events.on({
getfeatureinfo: function(e) {
<ADDED CODE - begin>
//get all existing popups
var popups = Ext.WindowMgr.getBy(function(win){return (win instanceof GeoExt.Popup)});
//kill all existing popups
popups.each(function(popup){popup.destroy()});
<ADDED CODE - end>
infopop = new GeoExt.Popup({ //utilizing the GeoExt popup functionality
title: "Hotspot Information",
//height: 215,
//width: 600,
autoWidth: true,
autoHeight: true,
autoScroll: false,
// panIn: true,
map: map,
lonlat: map.getLonLatFromPixel(e.xy),
html: e.text
})
etext = e.text;
// if the hotspot information is empty (layer doesn't match) don't display!
if (etext.length == 45)
{
infopop.close();
}
else
{
infopop.show();
}
}});
map.addControl(info);
info.activate();
--------------------------------------------------------------------------------
This e-mail is intended for the original recipient(s) only. If you have received it in error, please advise the sender and delete this message.
--------------------------------------------------------------------------------
_______________________________________________
Users mailing list
Users at geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users
--------------------------------------------------------------------------------
[This message has been scanned for security content threats and viruses.]
[The City of Red Deer I.T. Services asks that you please consider the environment before printing this e-mail.]
--------------------------------------------------------------------------------
This e-mail is intended for the original recipient(s) only. If you have received it in error, please advise the sender and delete this message.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20100920/0919b17f/attachment.htm
More information about the Users
mailing list