<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18975"></HEAD>
<BODY bgColor=#ffffff text=#000000>
<DIV dir=ltr align=left><SPAN class=897092820-24112010><FONT size=2 face=Arial>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.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=897092820-24112010><FONT size=2 face=Arial>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.</FONT></SPAN></DIV>
<DIV> </DIV><BR>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B> users-bounces@geoext.org
[mailto:users-bounces@geoext.org] <B>On Behalf Of
</B>geographika<BR><B>Sent:</B> November 24, 2010 1:17 PM<BR><B>To:</B>
users@geoext.org<BR><B>Subject:</B> Re: [Users] Question on using WMS
GetLegendGraphic with a GeoExt.tree.LayerNode<BR></FONT><BR></DIV>
<DIV></DIV>Hi,<BR><BR>Any luck if you try the following?<BR><PRE wrap=""> createNode: function(attr) {
attr.icon = <A class=moz-txt-link-rfc2396E href="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="</A>+attr.text
//alert(attr.icon);
        <B>return new Ext.tree.TreePanel.nodeTypes[attr.nodeType](attr);</B>
//return GeoExt.tree.LayerParamLoader.prototype.createNode.apply(this, arguments);
}</PRE><BR><BR>On 24/11/2010 17:02, Andrew Stewart wrote:
<BLOCKQUOTE cite=mid:94816848A8EB3941B1E8592F425827A981DC41847D@chex2.crdnet.ca
type="cite"><PRE wrap="">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 = <A class=moz-txt-link-rfc2396E href="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="</A>+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.
</PRE></BLOCKQUOTE>
<DIV>
<P>
<HR>
[This message has been scanned for security content threats and
viruses.]<BR><BR>[The City of Red Deer I.T. Services asks that you please
consider the environment before printing this e-mail.]<BR>
<P></P></DIV>
<DIV><P><HR>
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.
</P></DIV>
</BODY></HTML>