[Users] problem with TreeNodeRadioButton and first layer in tree
Robert Buckley
robertdbuckley at yahoo.com
Tue Mar 6 20:55:47 CET 2012
Hi,
I am trying to test the functionality of the radionode plugin. I have built a test app which lets the user switch the active layer and then use the getfeatureinfo tool to call the attributes.
The behaviour is rather strange though. The top layer in the tree does not give me the featureinfo output UNLESS it is the first layer to be active. But if layer 1 is activated first all the other layers will not give featureinfos!!?!
On the other hand, If I activate any of the other layers...ie. layer 2,layer 3 or layer 4, in any order, they all give a getfeatureinfo response EXCEPT for Layer 1!!!!
It is most probably something very simple to do with radio button activation or the getfeatureinfo tool, but i have looked for examples and can´t find anything that could help me.
It is also rather irritating that the layer name is taken from the openlayers "layer" config (ie. the name as it is stored in geoserver), and not from the "text" config which means that I can´t give the getFeatureinfo responses an understandable layer name.
If anyone could help I´d be most grateful,
cheers
Rob.
//CODE
var LayerNodeUI = Ext.extend(GeoExt.tree.LayerNodeUI, new GeoExt.tree.TreeNodeUIEventMixin());
var treeConfig = [{
nodeType: "gx_baselayercontainer",
hidden: true,
}, {
nodeType: "gx_overlaylayercontainer",
expanded: true,
loader: {
baseAttrs: {
radioGroup: "infoLayers",
uiProvider: "layernodeui"
}
}
}];
var featureInfo = new OpenLayers.Control.WMSGetFeatureInfo({
infoFormat: "application/vnd.ogc.gml",
queryVisible: true,
drilldown: true,
highlightOnly: true,
maxFeatures: 10,
eventListeners: {
"getfeatureinfo": function(e) {
var items = [];
Ext.each(e.features, function(feature) {
items.push({
xtype: "propertygrid",
title: feature.fid,
source: feature.attributes
});
});
new GeoExt.Popup({
url: "/geoserver/ows",
title: "getFeatureInfo",
layout: "border",
region:"east",
width: 250,
height: 450,
layout: "accordion",
bodyStyle: 'background-color:#FFF;,font-size:14px;',
autoScroll: true,
map: mapPanel.map,
location: e.xy,
//location: e.xy,
//lonlat: mapPanel.map.getLonLatFromPixel(e.xy),
// html: e.text,
maximizable: false,
resizable: false,
collapsible: false,
items: items
}).show();
}
}
});
map.addControl(featureInfo);
// featureInfo.activate();
treeConfig = new OpenLayers.Format.JSON().write(treeConfig, true);
tree = new Ext.tree.TreePanel({
border: true,
region: "west",
title: "Layers",
width: 250,
split: true,
collapsible: true,
collapseMode: "mini",
autoScroll: true,
plugins: [
new GeoExt.plugins.TreeNodeRadioButton({
listeners: {
"radiochange": function(node) {
selLayer = node.layer;
featureInfo.activate();
featureInfo.layers = [selLayer];
}
}
})
],
loader: new Ext.tree.TreeLoader({
applyLoader: false,
uiProviders: {
"layernodeui": LayerNodeUI
}
}),
root: {
nodeType: "async",
children: Ext.decode(treeConfig)
},
rootVisible: false,
lines: false,
});
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20120306/92f3cabb/attachment.htm
More information about the Users
mailing list