Select to view content in your preferred language

Editor Widget with custom back end

583
2
Jump to solution
11-24-2022 07:03 PM
quooston
Occasional Contributor

I am using the Editor Widget to add, update and delete features. However, the back end to the map is my own, so I am doing everything on the client. When feature layers are created, I applying the sources etc. 

I simply want to add an event handler to these editor workflows so that I can handle the resultant pending changes myself on my own back end. Watching the viewModel of the Editor does not facilitate this. There is no change in state between supplying the edits and clicking 'Create' for example, in the create workflow. 

There are also no specific events listed for the Editor Widget in the documentation. I want to intercept these events and then make the requisite calls to my back end to save the changes. 

Thanks

0 Kudos
1 Solution

Accepted Solutions
quooston
Occasional Contributor

I found the solution: 

 

 

editor.viewModel.featureFormViewModel.on('submit', _ => {
  console.log('submit');

  let values = editor.viewModel.featureFormViewModel.getValues();
  console.log(values);
});

 

 

View solution in original post

0 Kudos
2 Replies
quooston
Occasional Contributor

I found the solution: 

 

 

editor.viewModel.featureFormViewModel.on('submit', _ => {
  console.log('submit');

  let values = editor.viewModel.featureFormViewModel.getValues();
  console.log(values);
});

 

 

0 Kudos
kaleem_anjum
Emerging Contributor

The solution you found works for update . How did you detect the deleted features  as submit event does not get fired on delete button 

0 Kudos