[Users] Zoom to selected feature from grid

Robert Buckley robertdbuckley at yahoo.com
Mon Aug 30 17:31:21 CEST 2010


Thanks for the code,

I wanted to zoom in on the selected features in a grid. When I clicked the 
button, nothing happened.

I´d actually solved it using this snippet.

http://www.mail-archive.com/users@geoext.org/msg00353.html


var attribgridPanel = new Ext.grid.GridPanel({
                title: "Tabelle",
                region: "center",
                viewConfig: {forceFit: true},
                store: store,
                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}
                    ]
                }),
                bbar: [{
                text:"zoom to...",
                handler:function()
                    {
                    attribgridPanel.getSelectionModel().each(function(rec){
                        var feature = rec.get("feature");
                        mapPanel.map.zoomToExtent(feature.geometry.getBounds());
                        })
                    }    
                }]
                
                
            });

            


            var mainPanel = new Ext.Panel({
                renderTo: document.body,
                layout: "border",
                height: 850,
                width: 1400,                            
                items: [attribgridPanel, mapPanel]
            });


But the double click in the grid is also a logical thing to add.

Does it still not work in IE?

Thanks,

 Robert





More information about the Users mailing list