[Users] Question on using WMS GetLegendGraphic with a GeoExt.tree.LayerNode
Andrew Stewart
Andrew.Stewart at reddeer.ca
Wed Nov 24 21:30:05 CET 2010
I tried that but it didn't work.. thanks for the suggestion but I think something else in my code is messing it up cause it should work obviously.
I just did this a different way by using preloadChildren: true on each treenode and then setting the text attribute on each node to my request image and the name of the node on the 'load' event of my root node and it seems to work good/fast this way. Appreciate the help.
________________________________
From: users-bounces at geoext.org [mailto:users-bounces at geoext.org] On Behalf Of geographika
Sent: November 24, 2010 1:17 PM
To: users at geoext.org
Subject: Re: [Users] Question on using WMS GetLegendGraphic with a GeoExt.tree.LayerNode
Hi,
Any luck if you try the following?
createNode: function(attr) {
attr.icon = "http://localhost/WebServices/Request.aspx?request=GetLegendGraphic&version=1.1.1&format=image/png&style=&layer="<http://localhost/WebServices/Request.aspx?request=GetLegendGraphic&version=1.1.1&format=image/png&style=&layer=>+attr.text
//alert(attr.icon);
return new Ext.tree.TreePanel.nodeTypes[attr.nodeType](attr);
//return GeoExt.tree.LayerParamLoader.prototype.createNode.apply(this, arguments);
}
On 24/11/2010 17:02, Andrew Stewart wrote:
Hi Andreas for your suggestion. I am still having some difficulties with the parameters for this.. Except when I issue the same request in my browser I am getting the correct legend graphic returned but when I run it through the code I am getting nothing showing up.
I modified my code to this -
//Labels layerlist
layerList_Labels = new GeoExt.tree.LayerNode({
"layer": layer_Labels,
"isLeaf": true,
"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",
createNode: function(attr) {
attr.icon = "http://localhost/WebServices/Request.aspx?request=GetLegendGraphic&version=1.1.1&format=image/png&style=&layer="<http://localhost/WebServices/Request.aspx?request=GetLegendGraphic&version=1.1.1&format=image/png&style=&layer=>+attr.text
alert(attr.icon);
return GeoExt.tree.LayerParamLoader.prototype.createNode.apply(this, arguments);
}
}
});
And nothing shows up.. However if I copy the url of attr.icon and paste this in my browser I do see the correct legend graphic for the legend entry. Should I change this around because my childnodes are not expanded first on initial load? I have also tried to add the style= and it didn't seem to have any affect or make it stop working either. Thanks again for the help.
________________________________
[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/20101124/4b4d7aea/attachment.htm
More information about the Users
mailing list