var editorWidget; function startEditing(){ map.addLayers(editLayers); dojo.connect(map, "onLayersAddResult", initEditing); } function stopEditing(){ editorWidget.destroy(); } function initEditing(results) { var featureLayerInfos = dojo.map(results, function(result) { return { "featureLayer": result.layer }; }); var settings = { map: map, layerInfos: featureLayerInfos }; var params = { settings: settings }; editorWidget = new esri.dijit.editing.Editor(params, 'editorDiv'); var options = {snapKey:dojo.keys.copyKey}; map.enableSnapping(options); editorWidget.startup(); }
Solved! Go to Solution.
function stopEditing(){ editorWidget.destroy(); dojo.create("div", {id: "editorDiv"}, "leftPane"); }
function startEditing(){ map.addLayers(editLayers); dojo.connect(map, "onLayersAddResult", initEditing); }
function startEditing(){ dojo.connect(map, "onLayersAddResult", initEditing); map.addLayers(editLayers); }
Hi Jim,
I was able to reproduce the same error message. Calling destroy() should prevent this. After calling the destroy method, I checked the dijit.registry and the editorDiv widget was not there. I'm not sure where else this could be stored. This may be a bug.
I'm curious, when you enable editing do you have to execute your menu selection twice when you start an edit session for the first time? When I start my edit session for the first time, I have to click on the 'Start Editing' button twice.
This is the generic "destructor" function that all widget users should call to cleanly discard with a widget. Once a widget is destroyed, it is removed from the manager object.