var tmpGraphic = new Graphic({
attributes: {
"objectid": someObjectID
"someAttribute" : someAtrribute
}
});
featureLayer.applyEdits({
updateFeatures: [tmpGraphic]
}).then....
The applyEdits request shows the geometry for the graphic as null, thus overwriting the geometry on the feature layer.
I assume this is new as it hasn't been happening before...
Any ideas?
Solved! Go to Solution.
Instead of passing in a Graphic to apply Edits, try just passing in an object like:
let graphicObj = {
attributes: {
objectId: 1,
attr1: 5,
attr2: "hi"
}
}
featureLayer.applyEdits({
updateFeatures: [graphicObj]
}).then(...)
You could also try getting the object by doing let json = graphic.toJSON() and then delete json.geometry.
Kyle,
??? Why would not not get the actual graphic and just update the properties and then applyEdits that way the geometry is not null?
Because I have 1000+ features in a table and am using a select to change an attribute. No geometry, so getting the actually geometry would require returning it in the query and that would be wasteful performance wise.
Instead of passing in a Graphic to apply Edits, try just passing in an object like:
let graphicObj = {
attributes: {
objectId: 1,
attr1: 5,
attr2: "hi"
}
}
featureLayer.applyEdits({
updateFeatures: [graphicObj]
}).then(...)
You could also try getting the object by doing let json = graphic.toJSON() and then delete json.geometry.
Thanks, passing just an object worked. I assumed it had to be a Graphic object.