How to update value of field in Editor Widget (4.x)

07-13-2021 10:35 AM
Regular Contributor

platform: Experience Builder Dev v1.4, Javascript API 4.19

I would like to update the value of a field in the Editor Widget. I have attempted to update featureFormViewModel.feature.attributes but this does not show up in the EditorWidget. I have attempted to refresh the layer of the view model without luck: 







I've not yet tried to use applyEdits on the feature layer. It seems I should be able to update the data before sending off with this function. 




const editorWidget = new Editor({view: view, container: container})'viewModel.featureFormViewModel.feature', (newValue) => {
    newValue.attributes.site_city = "New City"

const attributes = editorWidget.viewModel.featureFormViewModel.getValues()
console.log(attributes) //Updated city name is not shown in the attributes

const attributes = editorWidget.viewModel.featureFormViewModel.feature.attributes
console.log(attributes) //Updated city name IS shown in the attributes




Tags (2)
0 Kudos
0 Replies