[Users] auto-pan works with ExtJS v2.2.1 but not v3.0.0

Andreas Hocevar ahocevar at opengeo.org
Mon Dec 21 10:11:23 CET 2009


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
>
> -----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.
>
>
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>   


-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.



More information about the Users mailing list