I have problem with my javascript code for Apply.edit here the code
delMaintData: function(){
console.log('Bri');
var maintTable = new FeatureLayer(this.dataSelect.get("value"));
console.log('layer',maintTable);
var delrecord = this.OBJECTID.get('value');
console.log(delrecord);
maintTable.applyEdits( null, null, delrecord, function(delrecord){
//readTable(dijit.byId('assetId').get('value'));
//dijit.byId('dialogAsset').hide();
console.log(delrecord);
});
}
Until this code console.log(delrecord); , the code still working properly that will produce the object id to delete
But on console.log(delrecord); will produce Undefined that means unable to complete operation. Anything problem or are there anything mistakes ?
Please help me. Thanks
Sorry, not really possible as our GDB is intranet-based. I found a workaround so I'm good. Just thinking that if this is indeed a bug, it should be fixed, or at least documented for what the expected format is for related tables. And please keep in mind too, that I've had absolutely no problem using applyEdits for adds and updates. It's only problematic for deletes. Thanks.
Hello, i have this alternative for u, i hope this helps u.
var userData = 1; //this contain the objectid number. And if its more than one, needs to be an array of objectids {[1,2,3]}
import _ from 'lodash';
function delSomething(userData,callback){
const data = {
f: 'json',
deletes: userData,
token: token.read()
};
jQuery.ajax({
method: 'POST',
url: myurltoservice + "/applyedits",
dataType:'html',
data: data
})
.done(d =>{
console.log(d);
let json = JSON.parse(d);
if( (_.has(json,'error')) ){
return callback(false);
}else{
let arrObject = [];
if(json["deleteResults"][0].objectId>0){
return callback(true);
}else{
return callback(false);
}
}
})
.fail(f=>{
console.log(f,"no pase")
callback(false)
});
}