I'm writing a feature layer editor demo and I'm using the esri.dijit.editing.Editor class.
According to documentation (https://developers.arcgis.com/javascript/jsapi/editor-amd.html), both attribute edits and geometry edits are saved automatically.
- Attribute edits are saved automatically when you change selection, change the focus field, or press enter.
- Geometry edits are saved automatically.
The editor is working fine but I wanna add a save button to applyEdits only after click it.
Follow my source code and my attempts:
var params = {
settings: {
map: map,
geometryService: geometryService,
templatePicker: templatePicker,
layerInfos: [
{
featureLayer: featureLayer
}
],
toolbarVisible: true,
enableUndoRedo: true,
maxUndoRedoOperations: 15,
createOptions: {
polylineDrawTools: [
Editor.CREATE_TOOL_FREEHAND_POLYLINE,
Editor.CREATE_TOOL_POLYLINE
],
polygonDrawTools: [
Editor.CREATE_TOOL_FREEHAND_POLYGON,
Editor.CREATE_TOOL_POLYGON,
Editor.CREATE_TOOL_RECTANGLE
]
},
toolbarOptions: {
cutVisible: true,
mergeVisible: true,
reshapeVisible: true
},
layerInfo: {
disableGeometryUpdate: true
}
}
};
var editorWidget = new Editor(params, "<editor-div-id>");
editorWidget.startup();
I've tried to stop event propagation using dojo/_base/event but the argument passed in before-apply-edits (FeatureLayer) is not a "valid event".
featureLayer.on('before-apply-edits', function(e) {
// ...
event.stop(e); // will trow error
});
Tried to clear the edits array too but continue saving:
featureLayer.on('before-apply-edits', function(e) {
// ...
e.adds = [];
e.updates = [];
e.deletes = [];
});
Someone know how to prevent this behavior?