You can get the layer name out of the attr object that is passed too. In my
case I have a GeoExt.data.LayerStore that contains the layers so I can find out
the layer name by doing:
var layer = store.getById(attr.layer.id).get('layer');
var layer_name = layer.params.LAYERS;
There might be a better way but it works for me.
Regards,
Miles
Matt Priour wrote:
> I really like that fix, I will have to try that too.
> Thanks so much for sharing.
> Matt Priour
> Kestrel Computer Consulting
>
> --------------------------------------------------
> From: "Miles Jordan" <[email protected]>
> Sent: Tuesday, July 20, 2010 6:58 PM
> To: "'Jehanzeb Orakzai'" <[email protected]>
> Cc: "GeoExt" <[email protected]>
> Subject: Re: [Users] Error while try to display LegendGraphics in
> Layer Tree [SEC=Unclassified]
>
>> Jehanzeb Orakzai wrote:
>>> Hi Miles,
>>>
>>> Thank you for the reply.
>>>
>>> I have tried this also, but no luck. If u have a working example can
>>> you post it please.
>>>
>>>
>>> Thank you,
>>
>> This works for me with Ext 3.0, 3.1 and 3.2.1.
>>
>> createIconNode = function(attr) {
>> var layer_name = ....;
>> attr.icon =
> '/servicesproxy/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&F
> ORMAT=image/png&WIDTH=20&HEIGHT=20&LAYER='
>> + layer_name;
>> return GeoExt.tree.LayerLoader.prototype.createNode.call(this,
> attr);
>> };
>>
>> And then the treepanel looks like:
>>
>> {
>> xtype: "treepanel",
>> loader: new Ext.tree.TreeLoader({
>> applyLoader: false
>> }),
>> root: {
>> nodeType: "async",
>> children: {
>> nodeType: "gx_overlaylayercontainer",
>> text: 'Some Layers',
>> layerStore: myLayerStore,
>> leaf: false,
>> expanded: true,
>> loader: {
>> createNode: createIconNode
>> }
>> }
>> }
>> }
>>
>>
>> Regards,
>>
>> Miles
Regards,
Miles
___________________________________________________________________________
Australian Antarctic Division - Commonwealth of Australia
IMPORTANT: This transmission is intended for the addressee only. If you are not
the
intended recipient, you are notified that use or dissemination of this
communication is
strictly prohibited by Commonwealth law. If you have received this transmission
in error,
please notify the sender immediately by e-mail or by telephoning +61 3 6232
3209 and
DELETE the message.
Visit our web site at http://www.antarctica.gov.au/
___________________________________________________________________________
_______________________________________________
Users mailing list
[email protected]
http://www.geoext.org/cgi-bin/mailman/listinfo/users