How to delete a polygon?

592
1
Jump to solution
08-25-2013 07:31 PM
JasonBarles
New Contributor II
Hi,

I have this code so far and it is able to execute the alert("hello"), but never gets into the function for applyEdits to delete a polygon. What am I doing wrong?

   dojo.connect(map.graphics, "onClick", function(evt) {   
     dojo.stopEvent(evt); 

       if (evt.ctrlKey === true) {  //delete feature if ctrl key is depressed
        alert("hello");
         map.graphics.applyEdits(null, null, [evt.graphic], function() {
          alert("delete");
            var operation = new esri.dijit.editing.Delete({
              featureLayer: map.graphics,
              deletedGraphics: [evt.graphic]
            });      
         });
        }
       
    });
0 Kudos
1 Solution

Accepted Solutions
JohnGravois
Frequent Contributor
applyEdits() is a featureLayer method.  if you just want to delete a graphic, just call map.graphics.remove(evt.graphic) instead

View solution in original post

0 Kudos
1 Reply
JohnGravois
Frequent Contributor
applyEdits() is a featureLayer method.  if you just want to delete a graphic, just call map.graphics.remove(evt.graphic) instead
0 Kudos