Select to view content in your preferred language

What's wrong with this line of code?

2613
4
06-16-2011 08:53 PM
Gregme
by
Emerging Contributor
const currentUseTable:FeatureLayer = new FeatureLayer("http://xxx/ArcGIS/rest/services/yyy/zzz/FeatureServer/2");
currentUseTable.addEventListener(FeatureLayerEvent.EDITS_COMPLETE, currentUseTableEditsComplete);
currentUseTable.applyEdits(null, null, [ {OBJECTID:403} ]); 


See anything wrong with this? I can add and edit but nothing happens when I delete. There is a record in the table that I am tring to delete from with the ObjectID of 403. When I call the code, nothing happens. No error, the currentUseTableEditsComplete function is never called and the record is not deleted.

I've been staring at this for hours and just can't figure out anything else to try. Please help!
Tags (2)
0 Kudos
4 Replies
Gregme
by
Emerging Contributor
I changed the code so that I have an error handler. Here's the error message:
[RPC Fault faultString="Unable to complete  operation." faultCode="400" faultDetail="Invalid parameters"]
0 Kudos
DasaPaddock
Esri Regular Contributor
You should wait for the FeatureLayer to load before calling applyEdits() and you should pass it Graphic instances.

You find this easier to use instead:
http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/tasks/FeatureLayerTask.html#applyEdits()
0 Kudos
HaroldBostic
Frequent Contributor
I can confirm that there is better success with the FeatureLayerTask.  In the code below, the commented out section did work, where as the other code did
var feat:Graphic = new Graphic(null,null,attr);
    var tblAddersTask:FeatureLayerTask = new FeatureLayerTask(tblAdders.url);
    tblAddersTask.applyEdits(null,null,[feat],"ObjectID",new AsyncResponder(onUpdateComplete,onUpdateFault,token));
    //tblAdders.applyEdits(null,null,[779],new AsyncResponder(onUpdateComplete,onUpdateFault,token));
0 Kudos
SergioSamarelli
New Contributor
Anyone have sent a serious answer on the issue? I have the same problem and I can't understand how to solve it. Please don't propose work around or redirect to documentation (without samples)

Maurizio
0 Kudos