[Users] auto-pan works with ExtJS v2.2.1 but not v3.0.0
White, Gary D. [OS-US]
GARY.D.WHITE at saic.com
Tue Dec 22 08:15:38 CET 2009
FYI
I've created http://trac.geoext.org/ticket/187 (autopan feature request)
and http://trac.geoext.org/ticket/188 (ExtJS 3.0.0 upgrade issue).
Thanks again for the help,
Gary
-----Original Message-----
From: users-bounces at geoext.org [mailto:users-bounces at geoext.org] On
Behalf Of Andreas Hocevar
Sent: Monday, December 21, 2009 4:11 AM
To: White, Gary D. [OS-US]
Cc: users at geoext.org
Subject: Re: [Users] auto-pan works with ExtJS v2.2.1 but not v3.0.0
Hi,
without looking at all this in detail, but you should definitely be
sharing the SelectFeature control between the Action and the
FeatureSelectionModel.
I can think of another way to fix your issue: right now you add
[mapPanel, gridPanel] to your mainPanel. Try to add [gridPanel,
mapPanel] instead.
The nature of this problem is that components like the
FeatureSelectionModel connect two components. As soon as this happens,
the sequence in which the involved components are rendered can become an
issue. So if you can strip down your code that shows the problem
isolated in a few lines of code instead of the >200 you have now, we
would appreciate if you create a ticket with that code attached.
I also agree that auto-panning to a selected feature is a common use
case, and it could optionally be handled by the FeatureSelectionModel.
You could create a feature request ticket for that too.
Regards,
Andreas.
White, Gary D. [OS-US] wrote:
> Thanks for the response Andreas.
>
> I've spent another day mucking with this without much luck (including
> trying your suggestions).
>
> What I had done that was working under ExtJS 2.2.1 was to combine the
> functionality of
> http://dev.geoext.org/trunk/geoext/examples/feature-grid.html with
> http://dev.geoext.org/trunk/geoext/examples/toolbar.html while adding
a
> handler that automatically panned the map if a point feature was
> selected in the grid that was outside of the current extent:
>
> eventListeners: {
> featurehighlighted : function(evt) {
> var feat = evt.feature;
> var map = feat.layer.map;
> var coord = new OpenLayers.LonLat(feat.geometry.x,
> feat.geometry.y);
> if (!map.getExtent().containsLonLat(coord))
> map.panTo(coord);
> }
> }
>
> Everything worked as expected and life was good (or so I thought).
> Updating from 2.2.1 to 3.0.0 managed to break this. The only way I
> could get this to work originally was to use the same
> OpenLayers.Control.SelectFeature object for both the GeoExt.Action in
> the toolbar and the GeoExt.grid.FeatureSelectionModel for the grid. I
> have been able to get it partially working under 3.0.0 by using
separate
> OpenLayers.Control.SelectFeature objects for the grid and the action
but
> that causes the "Select" button not to have any effect.
>
> I'm hoping that someone can either take a quick look at the code
> (attached to original email) and suggest a fix or perhaps suggest an
> alternate method for accomplishing the auto-pan when selecting
features
> in the grid that are outside of the current extent. This seems like
> such a common use case that others have hopefully encountered/solved
it
> already or might find such a solution helpful (perhaps even an
examples
> candidate).
>
> Also, I was thinking that this might catch the interest of anyone
> involved with adding 3.x.x support to GeoExt since it seems to be a
> potential compatibility issue.
>
> Thanks again,
> Gary
>
More information about the Users
mailing list