[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
Mon Dec 21 09:35:40 CET 2009
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
-----Original Message-----
From: users-bounces at geoext.org [mailto:users-bounces at geoext.org] On
Behalf Of Andreas Hocevar
Sent: Sunday, December 20, 2009 4:25 PM
To: Gary White
Cc: users at geoext.org
Subject: Re: [Users] code works with ExtJS v2.2.1 but not v3.0.0
Gary White wrote:
>
> I've been pulling my hair out trying to get the attached code to work
> with ExtJS v3.0.0. It works fine with 2.2.1 but I get the following
> error with 3.0.0:
>
> Error: this.el is undefined
>
> Source File: http://extjs.cachefly.net/ext-3.0.0/ext-all-debug.js
>
> Line: 40920
>
This line of ext-all-debug is about toggling a button. So I'd say Ext is
trying to access the DOM of the button that your action is attached to
before the button is rendered. This happens because it wants to toggle
the state of the button. If I were you, I'd try to experiement with the
pressed config option of the action. Try to set it to false, see if it
works then. If not, try to set it to true.
Regards,
Andreas.
More information about the Users
mailing list