Since the Editor widget is creating your feature you can't pass any attributes at creation, you need to set up an event monitor for the layer being edited, and then when that occurs create the attribute for the feature and save it using Apply Edits.
Maybe something like this:
aLayer.on("apply-edits", function (results) { if (results.edits.addFeatures) { var newObjectId = results.addFeatureResults[0]["objectId"]; console.log("Added new feature with objectID: ", newObjectId); var edit = [{"id" : 0, "updates": [ "attributes": { "OBJECTID": newObjectId, "datetime": 1272210710000, "Somefield": "This is an updated value" } ] }] var promise = aLayer.applyEdits(edit); console.log(promise); } })
Ingelogde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Maak gratis een account aan.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.