Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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/

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

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();
        })
    }
 }
share|improve this answer
    
A week ago i spent whole a day to understand that. –  Kliver Max Jul 27 '12 at 8:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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