[Users] LayerOpacitySlider: setLayer() does not work from ComboBox select event
Daniel Behr
daniel.behr at hzg.de
Fri Aug 19 14:53:43 CEST 2011
oh well, I'm damn sure this was the first thing I tried. Must have been
missing something else at that point.
Thanks Bart, it works as expected now!
cheers
Daniel
Am 19.08.2011 14:41, schrieb Bart van den Eijnden:
> Hi,
>
> try
>
> opacitySlider.setLayer(record.getLayer())
>
> Best regards,
> Bart
>
> --
> Bart van den Eijnden
> OSGIS - http://osgis.nl <http://opengeo.org/>
>
> 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
More information about the Users
mailing list