[Users] GeoExt.Action (Button) to show/hide Layer
gbrun
gbrun at myopera.com
Thu Sep 8 13:20:46 CEST 2011
You try to use a GeoExt action. For this, you need to define an OpenLayers
control. That's why you received this 'undefined' message.
Instead of GeoExt action, try to use a classic Ext button and it should
work (only if you don't have any OpenLayers control). For the "checked"
problem, I think you can use "pressed" instead.
Geoffrey
On Thu, 08 Sep 2011 12:05:44 +0200, Kai Volland <kaivolland at web.de> wrote:
> Hi Users,
>
> i've some issues with using a Button to show/hide a Layer in my map.
>
> 1. "checked:true" doesn't work
> 2. I get an error whne first check and uncheck the button:
> this.control is undefined
> this.control.activate();
> this.control is undefined
> this.control.deactivate();
>
> 3. Afterwards the button seems to work, but unchecking it doesn't affect
> the Layer (it stays visible).
>
> CODE:
> var action1 = new GeoExt.Action({
> text: 'Sites',
> map: map,
> tooltip: 'NESPOS - SITES',
> enableToggle: true,
> handler: function(toggled){
> if (toggled) {
> nespos.setVisibility(true);
> } else {
> nespos.setVisibility(false);
> }
> },
> checked: true
> });
> actions["Sites"] = action1;
> toolbarItems.push(action1);
> toolbarItems.push("-");
>
>
> Kind regards,
>
> Kai
--
Using Opera's revolutionary email client: http://www.opera.com/mail/
More information about the Users
mailing list