brightbluesky

onEditsComplete to update another field in the feature

Discussion created by brightbluesky on Dec 26, 2012
Latest reply on Jan 4, 2013 by jgrayson-esristaff
I have been trying to add an entry to a featureLayer and in want to get a callback from this so I can update another field in it. below is my code
clkListenerAddFeature = dojo.connect(map, "onClick", function (evt)
{
    //alert("inside the click function");
    var point = evt.mapPoint;

    var attributes = {};
    attributes["1"] = "CLOSED";
    attributes["2"] = "DENIED"; 
    attributes["3"] = "0";
    attributes["4"] = "1";
    attributes["5"] = userLoginId;

    var graphic = new esri.Graphic(point, null, attributes);
    featureLayerEdit.applyEdits([graphic], null, null);
    dojo.connect(featureLayerEdit, "onEditsComplete", addResultsComplete);

    if (clkListenerAddFeature) dojo.disconnect(clkListenerAddFeature);
    refresh_map();
    reset_map(map);

});

function addResultsComplete(addResults)
{
    if (addResults.length > 0) {
        var graphic = featureLayerEdit.graphics[featureLayerEdit.graphics.length - 1];

        graphic.attributes["6"] = graphic.attributes["OBJECTID"];
        featureLayerEdit.applyEdits(null, [graphic], null);
    }

}

but I keep hitting this error
TypeError: Unable to get value of the property 'getCellsInExtent': object is null or undefined


anyone has any ideas?

Outcomes