我正在尝试使用arcgis javascript FeatureLayer Eidting ...
但是...经常编辑功能无法正常工作。
编辑不适用于数据库。
我测试如下。
答案 0 :(得分:0)
我的代码如下:
esriConfig.defaults.geometryService = new esri.tasks.GeometryService(" https://utility.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");
map.on(" layers-add-result",initEditing);
var SIDO = new FeatureLayer("http://dev.smui.co.kr:26080/arcgis/rest/services/kios/FEATURE_LP_AA/FeatureServer/0", {`enter code here`
mode: FeatureLayer.MODE_SNAPSHOT,
outFields: ["*"]
});
map.addLayers(SIDO);
function initEditing(evt) {
console.log("initEditing", evt);
// var map = this;
var currentLayer = null;
var layers = arrayUtils.map(evt.layers, function(result) {
return result.layer;
console.log("result ==== "+result);
});
console.log("layers", layers);
editToolbar = new Edit(map);
editToolbar.on("deactivate", function(evt) {
console.log("deactivate !!!! ");
currentLayer.applyEdits(null, [evt.graphic], null);
});
arrayUtils.forEach(layers, function(layer) {
var editingEnabled = false;
layer.on("dbl-click", function(evt) {
event.stop(evt);
if (editingEnabled === false) {
editingEnabled = true;
editToolbar.activate(Edit.EDIT_VERTICES , evt.graphic);
pre_evt = evt.graphic;
console.log("dbl-click & eidt true");
} else {
currentLayer = this;
editToolbar.deactivate();
editingEnabled = false;
console.log("dbl-click & eidt false ");
}
});