dojo.connect(yesAddButton, "onclick", function () { dijit.byId("addFeatureDialog").hide(); //when features are added - add them to the undo manager selectedTemplate.featureLayer.applyEdits([newGraphic], null, null, function() { var operation = new esri.dijit.editing.Add({ featureLayer: selectedTemplate.featureLayer, addedGraphics: [newGraphic] }); undoManager.add(operation); checkUI(); }); }); dojo.connect(noAddButton, "onclick", function () { dijit.byId("addFeatureDialog").hide(); });
<div id="addFeatureDialog" data-dojo-type="dijit.Dialog" style="display: none;" title="Add Feature to Database?"> <p>Do you want to add this location to the database?</p> <div id="yesNoDiv"> <div id="yesAddButton" data-dojo-type="dijit.form.Button" >Yes</div> <div id="noAddButton" data-dojo-type="dijit.form.Button" >No</div> </div> <!-- end #yesNoDiv --> </div> <!-- end #addFeatureDialog -->
//once the geometry is drawn - call applyEdits to update the feature service with the new geometry dojo.connect(drawToolbar, "onDrawEnd", function(geometry) { drawToolbar.deactivate(); var dialog = dijit.byId("addFeatureDialog"); var newAttributes = dojo.mixin({},selectedTemplate.template.prototype.attributes); var newGraphic = new esri.Graphic(geometry,null,newAttributes); dialog.style.display = "block"; dialog.closeButtonNode.style.display = "none"; dialog.show(); dojo.connect(yesAddButton, "onclick", function () { dijit.byId("addFeatureDialog").hide(); //when features are added - add them to the undo manager selectedTemplate.featureLayer.applyEdits([newGraphic], null, null, function() { var operation = new esri.dijit.editing.Add({ featureLayer: selectedTemplate.featureLayer, addedGraphics: [newGraphic] }); undoManager.add(operation); checkUI(); }); }); dojo.connect(noAddButton, "onclick", function () { dijit.byId("addFeatureDialog").hide(); }); });
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.