[Users] LayerOpacitySlider: setLayer() does not work from ComboBox select event

Bart van den Eijnden bartvde at osgis.nl
Fri Aug 19 14:41:08 CEST 2011


Hi,

try

opacitySlider.setLayer(record.getLayer())

Best regards,
Bart

-- 
Bart van den Eijnden
OSGIS - http://osgis.nl

On Aug 19, 2011, at 2:39 PM, Daniel Behr wrote:

> Hello Everyone !
> 
> I'm having problems setting a new layer on the GeoExt LayerOpacitySlider 
> with its setLayer method.
> 
> I have a ComboBox configured like this:
> 
> ***
> layerComboBox = new Ext.form.ComboBox({
>     mode: "local",
>     store: new GeoExt.data.LayerStore({
> 	layers: getVisibleLayersArray()
>     }),
>     listeners: {
> 	scope: map, // or: this
> 	select: function(combo,record){
>  	    opacitySlider.setLayer(record.getLayer().params.ID)
> 	    })
> 	}
>     },
>     displayField: 'title',
>     title: 'Transparency'
> });
> ***
> 
> On the select event of this ComboBox I want to change the layer of this 
> opacitySlider:
> 
> ***
> var opacitySlider = new GeoExt.LayerOpacitySlider({
>         layer: null,
>         aggressive: true,
>         width: 150,
>         inverse: true,
>         plugins: new GeoExt.LayerOpacitySliderTip({
>             template: "<div>{opacity}% transparent</div>"
>         })
> });
> ***
> 
> Both components work fine on their own and if I assign the setLayer() 
> method to the maps zoomend or some other event, the slider layer is 
> actually updated!
> 
> My guess is, that this is related to the GeoExt setLayer() function and 
> the scope it is executed in.
> I did some trial and error, without success.
> 
> I hope someone can shed some light on this...
> 
> thanks in advance!
> Daniel
> Helmholtz-Zentrum Geesthacht 
> Zentrum für Material- und Küstenforschung GmbH 
> Max-Planck-Straße 1 I 21502 Geesthacht I Deutschland/Germany 
> 
> Geschäftsführer/Board of Management: Prof. Dr. Wolfgang Kaysser, Dipl.-Ing. Michael Ganß 
> Vorsitzender des Aufsichtsrates/Chairman of the Supervisory Board: MinDirig Wilfried Kraus 
> Amtsgericht Lübeck HRB 285 GE (Register Court) 
> Internet: http://www.hzg.de  
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20110819/72f5ed5d/attachment.htm 


More information about the Users mailing list