[Users] code works with ExtJS v2.2.1 but not v3.0.0

Andreas Hocevar ahocevar at opengeo.org
Sun Dec 20 22:25:29 CET 2009


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.


> I’ve narrowed it down to the following bits (below the sig). 
> “selFeatCtl”—in addition to being used as the selectControl for the 
> FeatureSelectionModel in the GridPanel—is also used as the control for 
> a GeoExt.Action (not shown below but is in the attached code). The 
> code works under 3.0.0 if I just use the plain 
> GeoExt.grid.FeatureSelectionModel() constructor for the sm in the 
> GridPanel (but of course then the featurehighlighted handler doesn’t 
> work).
>
> Any help is greatly appreciated,
>
> Gary
>
> var selFeatCtlCfg = {
>
> type: OpenLayers.Control.TYPE_TOGGLE,
>
> hover: true,
>
> 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);
>
> }
>
> }
>
> } ;
>
> var selFeatCtl = new OpenLayers.Control.SelectFeature(vecLayer, 
> selFeatCtlCfg);
>
> var selModel = new GeoExt.grid.FeatureSelectionModel({selectControl : 
> selFeatCtl});
>
> // create grid panel configured with feature store
>
> gridPanel = new Ext.grid.GridPanel({
>
> title: "Feature Grid",
>
> region: "east",
>
> store: store,
>
> width: 500,
>
> columns: [
>
> {
>
> header: "ID",
>
> width: 50,
>
> dataIndex: "id"
>
> },
>
> {
>
> header: "Latitude",
>
> width: 200,
>
> dataIndex: "latitude"
>
> },
>
> {
>
> header: "Longitude",
>
> width: 200,
>
> dataIndex: "longitude"
>
> }
>
> ],
>
> // sm: new GeoExt.grid.FeatureSelectionModel()
>
> sm: selModel
>
> });
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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