[Users] Question on using WMS GetLegendGraphic with a GeoExt.tree.LayerNode
Andrew Stewart
Andrew.Stewart at reddeer.ca
Tue Nov 23 00:22:16 CET 2010
So I have tried to change the icon of each childNode after the expand event like so -
'expand' : {fn: function(node) {
var count = (node.childNodes.length -1);
while (count >= 0)
{node.childNodes[count].setIcon("../images/minus.png");
count -=1;
}
}}
But this does not seem to work, anything else I can try?
________________________________
From: users-bounces at geoext.org [mailto:users-bounces at geoext.org] On Behalf Of Andrew Stewart
Sent: November 22, 2010 3:51 PM
To: users at geoext.org
Subject: [Users] Question on using WMS GetLegendGraphic with a GeoExt.tree.LayerNode
Is it possible to show a legend graphic which is returned from my WMS GetLegendGraphic request next to each item on the LayerNode after it is expanded? (or before.. Or whenever as long as it shows).
I declare my layernode like so -
//Trails layerList
layerList_Trails = new GeoExt.tree.LayerNode({
"layer": layer_Trails,
"isLeaf": false,
"checked": false,
"enableDD": true,
"cls": "rootnode",
"singleClickExpand": true,
"listeners": {
'checkchange' : function(node, checked)
{
// If a parent node is unchecked, uncheck all the children
if (node.getUI().isChecked()) {
node.expand();
}
if (!node.getUI().isChecked())
{
node.collapse();
}
}
},
"loader": {
"param": "LAYERS"
}
});
Which is added to my root -
layerRoot_Legend.appendChild(layerList_Trails);
And then my treepanel
var layerRoot_Legend = new Ext.tree.TreeNode({
enableDD: true,
text: "All Legend Items",
loaded: true,
expanded: true
});
var layerTree_Legend = new Ext.tree.TreePanel({
title: '',
root: layerRoot_Legend,
enableDD: true,
applyLoader: true,
rootVisible: false
});
Except previously when I declared my layers individually I had put an <img> tag with the right layer next to each.. But now I am declaring them in groups like -
//Trails Group
var layer_Trails = new OpenLayers.Layer.WMS("<img src='http://localhost/WebService/Request.aspx?request=GetLegendGraphic&version=1.1.1&format=image/png&layer=Asphalt' alt=''/>Trails", "http://localhost/WebService/Request.aspx",
{
layers: ['Onstreet_Bike_Route', 'Mountain_-_Stunt_Biking', 'Equestrian', 'Gravel_or_Shale', 'Asphalt'],
VERSION: "1.1.1",
transparent: true
},
{ isBaseLayer: false,
singleTile: true,
visibility: false,
buffer: 1,
ratio: 1
}
But this only puts the image on the actual group name and I need it to be beside each legend entry when it is expanded. Is there a place somewhere I can stick this image tag and either hard code the layer name or have it be returned from the childNodes of the tree and get it to show this image beside each childNode? Appreciate any assistance!
________________________________
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.
________________________________
[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.]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20101122/9d659297/attachment.htm
More information about the Users
mailing list