<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
Hi Mike & Alexandre,<br>
<br>
a problem could be that everytime, you selected a feature the event
gets triggered. I think a better way to solve this, is to add a
additional button inc. handler, something like this maybe:<br>
bbar: [{<br>
xtype: 'tbbutton',<br>
cls: 'x-btn-text-icon',<br>
tooltip: "Zoom To",<br>
icon: '../images/database_go.png',<br>
handler: function(){<br>
gridPanel.getSelectionModel().each(function(rec) {<br>
var feature = rec.get("feature");<br>
var bounds =
feature.geometry.getBounds().toBBOX();<br>
map.zoomToExtent(new
OpenLayers.Bounds.fromString(bounds));<br>
});<br>
}}]<br>
<br>
Best regards,<br>
Simon<br>
Am 03.03.2011 14:33, schrieb Alexandre Dube:
<blockquote cite="mid:4D6F988D.2020401@mapgears.com" type="cite">
<meta http-equiv="Context-Type" content="text/html;
charset=ISO-8859-1">
<title></title>
Hi Mike,<br>
<br>
Here's something you could do : listen to the vector layer
"featureselected" event to zoom to the extent of a feature
selected either from a click or row in the grid. Here's how it
should look like (using the example) :<br>
<br>
vecLayer.events.on({<br>
"featureselected": function(e) {<br>
this.map.zoomToExtent(e.feature.geometry.getBounds());<br>
},<br>
"scope": vecLayer<br>
});<br>
<br>
If you don't want the map to zoom to the max zoomed in level when
selecting a Point feature, you could manage them differently by
detecting the type of geometry first then do a
"map.setCenter(lonlat, zoom)" instead and define your own zoom
level when selecting points.<br>
<br>
Best regards,<br>
<br>
Alexandre<br>
<br>
<br>
On 11-03-02 01:44 PM, Michael Savarese wrote:
<blockquote
cite="mid:AANLkTims4wa3fvKE+==XTFiVKnvHYBHqtahkZtzGfBXn@mail.gmail.com"
type="cite">Greetings, I'm fairly new to GeoExt and OpenLayers
and I was experimenting with the example "Grid with Features" <a
moz-do-not-send="true"
href="http://api.geoext.org/1.0/examples/feature-grid.htm">http://api.geoext.org/1.0/examples/feature-grid.htm</a>l.
I'd like to zoom or pan to a feature when the feature is clicked
on the grid. I've had success with zooming to a feature with
OpenLayers but I have no idea how to bind that click to an
OpenLayers function. Any help in the form of an example or
reference would be appreciated. <br>
<br>
Mike<br>
<pre>
_______________________________________________
Users mailing list
<a moz-do-not-send="true" href="mailto:Users@geoext.org">Users@geoext.org</a>
<a moz-do-not-send="true" href="http://www.geoext.org/cgi-bin/mailman/listinfo/users">http://www.geoext.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
<br>
<pre>--
Alexandre Dubé
Mapgears
<a moz-do-not-send="true" href="http://www.mapgears.com">www.mapgears.com</a>
</pre>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@geoext.org">Users@geoext.org</a>
<a class="moz-txt-link-freetext" href="http://www.geoext.org/cgi-bin/mailman/listinfo/users">http://www.geoext.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</body>
</html>