[Users] GeoExt.Action (Button) to show/hide Layer

Kai Volland kaivolland at web.de
Thu Sep 8 12:05:44 CEST 2011


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20110908/aa73a34b/attachment.htm 


More information about the Users mailing list