[fusion-users] Get layer name from Legend right-click

Tom van der Putte tom at vdputte.nl
Thu Apr 15 10:31:18 EDT 2010


Hi
Mike,
 I was trying your solution, but I'm still a bit confused.
 This is my current code (within Legend.LegendRenderer)
 this.executeRasterQueryAction = new
Jx.Action(OpenLayers.Function.bind(this.getRasterQuery, this));
 this.executeRasterQueryItem = new
Jx.MenuItem(this.executeRasterQueryAction, {label:
OpenLayers.i18n('Execute raster query')});
 According to your explanation, the first line should then be:
 this.executeRasterQueryAction = new 
Jx.Action(OpenLayers.Function.bind(this.getRasterQuery, this, layer));
 Or am I wrong here? But how do I get the reference to the layer
thats clicked? Does that make sense what I'm saying? :) I'm not really
into the whole binding stuuf yet. Getting there though...
 Cheers,
 Tom
 On Thu 15/04/10 15:52 , Mike Adair madair at dmsolutions.ca sent:
 Tom,
 The menu items are only bound to the legend tree items/folders at
this 
 point.  I think what you would need to do is bind whatever object
you 
 need when setting up your onclick event, eg. the existing code looks
like:
                     onClick: 
 OpenLayers.Function.bind(this.collapseBranch, this, this.oRoot)
 but you probably want:
                     onClick: 
 OpenLayers.Function.bind(this.collapseBranch, this, this.oRoot,
layer)
 (or similar) and then in the method being bound, layer will appear
as 
 one of the arguments.
 Mike
 Tom van der Putte wrote:
 > Hi All,
 >
 > When right-clicking an item in the legend, a context manu appears.

 > I've added a entry to this menu, and clicking on it results in a 
 > certain function beeing executed. However, I want to check if the
item 
 > that was right-clicked in the legend is of a certain type. How can
I 
 > get to the layer name? I found something like targetFolder in the 
 > legend widget, but this obviously goes only for the folders?
 >
 > Cheers,
 >
 > Tom
 >
------------------------------------------------------------------------
 >
 > _______________________________________________
 > fusion-users mailing list
 > 
 > http://lists.osgeo.org/mailman/listinfo/fusion-users
 >   
 -- 
    Michael Adair
    Senior Software Architect
    DM Solutions Group Inc.
    Office: (613) 565-5056 x26
    http://www.dmsolutions.ca
    http://research.dmsolutions.ca
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/fusion-users/attachments/20100415/8170cf3b/attachment.html


More information about the fusion-users mailing list