[Users] problem with TreeNodeRadioButton and first layer in tree
Robert Buckley
robertdbuckley at yahoo.com
Wed Mar 7 09:37:16 CET 2012
Hi I have modified my tree but I am having a problem understanding how to use the radiochange function.
A test version is here http://maps.zgb.de/geoportal/treenodes.html
Firstly I don´t understand why the plugin has a listener AND the tree has listener.
Secondly I can´t figure out why the first node creates havoc. If the first node is the first to be active, then the other nodes do not work. However any other node is first active, then all others work apart from the first node.!?!?!?
I am simply trying to active the getFeatureInfo control for the active node.
If anyone can explain my error, I´d be most grateful,
Yours,
Rob
//my code
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) {
activeNode = node;
if(activeNode == node)
{
featureInfo.activate();
selLayer = node.layer;
featureInfo.layers = [selLayer];
}
else
{
featureInfo.deactivate();
}
}
}
})
],
loader: new Ext.tree.TreeLoader({
uiProviders: {
"layernodeui": LayerNodeUI
}
}),
root: {
nodeType: "async",
children: Ext.decode(treeConfig)
// Don't use the line above in your application. Instead, use
//children: treeConfig
},
listeners: {
"radiochange": function(node){
// alert(node.layer.name + " is now the the active layer.");
activeNode = node;
if(activeNode == node)
{
featureInfo.activate();
selLayer = node.layer;
featureInfo.layers = [selLayer];
}
else
{
featureInfo.deactivate();
}
}
},
rootVisible: false,
lines: false,
});
________________________________
Von: Robert Buckley <robertdbuckley at yahoo.com>
An: "users at geoext.org" <users at geoext.org>
Gesendet: 20:55 Dienstag, 6.März 2012
Betreff: [Users] problem with TreeNodeRadioButton and first layer in tree
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,
});
_______________________________________________
Users mailing list
Users at geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20120307/33767046/attachment-0001.htm
More information about the Users
mailing list