[Users] problem with WFS-T tutorial: cannot add FeatureSelectionModel

Eric Lemoine eric.lemoine at camptocamp.com
Sat Jan 29 13:55:06 CET 2011


On Fri, Jan 28, 2011 at 4:51 PM, Alex Dean <alex at crackpot.org> wrote:
> Hello.  I'm going through this tutorial using my local GeoServer installation.  I am using GeoExt 1.0, OpenLayers 2.10, and ext.js 3.2.1.
> http://workshops.opengeo.org/geoext/wfs/layer.html
>
> Code looks like this thusfar: http://pastie.org/1506095  It's the same as the example, with modifications to retrieve local data.
>
> Everything works as expected until I attempt to add 'sm: new GeoExt.grid.FeatureSelectionModel()' to my GridPanel.
>
> When I do that, I receive the error: "layer.map is null", in reference to "layer.map.addControl(selectControl)" on line 153 of FeatureSelectionModel.js.  If I remove this code, the map & grid render correctly.
>
> This seems similar to the problem reported in https://geoext.org/ticket/396

It is.

> but I am wondering if there is some other explanation.

The feature selection model fails to add its select feature control to
the map, because the vector layer hasn't been added to the map yet (so
layer.map is null). This whole issue comes from the fact that we
differ adding the layers to the map in the map panel.

> I've tried explicitly setting the layer's map property ("layer.map = mapPanel.map").  This removes the error I cited above, but raises new ones, and I suspect this isn't the correct way to solve the problem.

Indeed. You can try out the patch attached to #396. It should fix your problem.

Cheers,

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com


More information about the Users mailing list