[OpenLayers-Users] beforefeaturemodified not firing
Jim White
jbw2003 at earthlink.net
Thu Nov 17 14:43:19 EST 2011
I am attempting to configure an Editable WFS Layer according to example
at workshops.opengeo.org. The layer is a postgis linestring served by
geoserver.
var saveStrategy = new OpenLayers.Strategy.Save({auto:true})
var deeds = new OpenLayers.Layer.Vector("Land Grants", {
strategies: [new OpenLayers.Strategy.BBOX(),
saveStrategy],
protocol: new OpenLayers.Protocol.WFS({
url: "http://localhost:8080/geoserver/wfs",
featureType: "deeds"
}),
projection: new OpenLayers.Projection("EPSG:4326")
});
// Panel and edit controls. Hook save to the edit control
// to clear selection on save.
var panel = new OpenLayers.Control.Panel(
{'displayClass': 'customEditingToolbar'}
);
var edit = new OpenLayers.Control.ModifyFeature(deeds, {
title: "Move parcel",
displayClass: "olControlModifyFeature",
mode: OpenLayers.Control.ModifyFeature.DRAG
});
var save = new OpenLayers.Control.Button({
title: "Save Changes",
trigger: function() {
if(edit.feature) {
edit.selectControl.unselectAll();
}
saveStrategy.save();
},
displayClass: "olControlSaveFeatures"
});
// Create our tool bar
panel.addControls([save]);
map.addControl(panel);
// Make the only mode be edit mode
map.addControl(edit);
edit.activate();
map.addLayers([ deeds, norfolk, google_physical, osm]);
map.zoomToMaxExtent();
deeds.events.on({
'beforefeaturemodified': function(evt) {
console.log("Selected " + evt.feature.id + " for
modification");
},
'featureselected': function(evt) {
console.log("selected feature " + evt.feature.id);
}
});
When I click a feature the featureselected event fires, but the layer is
not editable and the beforefeaturemodified event does not fire.
Please help!
Jim White
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20111117/aa456244/attachment.html
More information about the Users
mailing list