[Users] Zoom to selected feature from grid

Robert Buckley robertdbuckley at yahoo.com
Mon Aug 30 16:31:47 CEST 2010


Hi,

I am having difficulties working out how to zoom to the selected feature in a 
grid.

My code is here...

var  editToolBar = new Ext.Toolbar({
            id:'editToolBar',
            items: [
                    {
                        xtype: 'tbbutton',
                        text: "an Auswahl heranzoomen",
                        handler: function() {

            GeoExt.grid.FeatureSelectionModel().each(function(rec) {
            var feature = rec.get("feature");

            mapPanel.map.zoomToExtent(feature.geometry.getBounds());
           })
           }
           }
                ]
            });


var gridPanel = new Ext.grid.GridPanel({
                title: "Tabelle",
                region: "center",
                viewConfig: {forceFit: true},
                store: store,
                bbar: editToolBar,
                sm: new GeoExt.grid.FeatureSelectionModel(),
                cm: new Ext.grid.ColumnModel({
                    defaults: {
                        sortable: true,
                    },
                    columns: [
                        {header: "Bez", dataIndex: "Bez",width: 25},
                        {header: "Standort", dataIndex: "Standort"},
                        {header: "Betreiber", dataIndex: "Betreiber", width: 
135},
                        {header: "Typ", dataIndex: "Typ", width: 35}
                    ]
                }),
                
            });


Could anyone help me out here?


thanks,


Robert Buckley




More information about the Users mailing list