3

I have a problem.
I have a ExtJs button and want to call anyone GeoExt action. For example this

{xtype:'tbbutton',
                        cls: 'x-btn-icon',
                        id: 'testbutton',
                        tooltip: "Рисовать",
                        icon: url_servlet+'externals/gxp/src/theme/img/silk/delete.png',
                        handler: function(){
                            new GeoExt.Action({
                                text: "max extent",
                                control: new OpenLayers.Control.ZoomToMaxExtent(),
                                map: app.mapPanel.map
                            })
                        }

                      }

But its not work and map not zoom to max extent. So where i can mistake. In ideal i want to call action from actionColumn's buttons/ I will glad if u help/

2

A GeoExt Action is already a button, so there is no need to create the ExtJS button as well. Create the GeoExt action and add it to a toolbar.

action = new GeoExt.Action({
    control: new OpenLayers.Control.ZoomToMaxExtent(),
    map: map,
    text: "max extent",
    tooltip: "zoom to max extent"
});

http://api.geoext.org/1.1/examples/toolbar.html

If you just want to have a button on a form to zoom to the max extent of the map, then call the zoomToMaxExtent function directly in the handler:

 {
    xtype:'tbbutton',
    cls: 'x-btn-icon',
    id: 'testbutton',
    tooltip: "Рисовать",
    icon: url_servlet+'externals/gxp/src/theme/img/silk/delete.png',
    handler: function(){
        app.mapPanel.map.zoomToMaxExtent();
        })
    }
 }
  • A week ago i spent whole a day to understand that. – Kliver Max Jul 27 '12 at 8:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.