[Users] Question on using WMS GetLegendGraphic with a GeoExt.tree.LayerNode

geographika geographika at gmail.com
Wed Nov 24 21:17:17 CET 2010


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="+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="+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.
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20101124/a0ebfeb4/attachment-0001.htm 


More information about the Users mailing list