I am displaying the attribute data in the popup on clicking on the map using openlayers,geoext.
But i want to hide some fields(fid,…..) from the table in the popup.
How to do this.
Below is my code
var control = new OpenLayers.Control.WMSGetFeatureInfo({
url: "http://localhost:8080/geoserver/cite/wms",
"LAYERS": 'xxxxxx',
srs:'EPSG:3857'
});
control.events.on({
getfeatureinfo: function(event) {
//close existing popup
if (popup) {
popup.destroy();
}
popup = new GeoExt.Popup({
title: "Feature Info",
map: mapPanel.map,
lonlat: mapPanel.map.getLonLatFromViewPortPx(event.xy),
width: 250,
autoScroll: true,
collapsible: true,
bodyStyle: {padding: 5},
location:event.xy,
html: event.text
});
popup.show();
}
});
mapPanel.map.addControl(control);
control.activate();
Best Answer
If you have control over the geoserver and you use the html format, you could modify the template server side. Otherwise I can think of retrieving the FeatureInfo as GML2 or text and modify if client-side. But I don't know how this might be implemented in openlayers.