Using ArcGIS API for JavaScript 4.x I am trying to create custom behavior for the Editor Widget. Specifically I want to watch for clicking the Add button on the create workflow or when clicking either Update or Delete on the update workflow. I am trying to use the editor.on() event handler, however, I am not seeing a list of events for the Editor widget. Other widgets, such as Search, have an Event Overview list (https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor.html#events-summary) but there does not seem to be one for Editor (https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor.html#events-summary).
A point in the right direction would be appreciated.
you need to use the .on or .watch in the editor.viewModel , there are 2 sub viewModels inside that tooeditor.viewModel.featureTemplatesViewModeleditor.viewModel.featureSketchViewModelthis will trigger on all editor states, you can check which event you need to trigger your custom code
editor.viewModel.watch("state", function (state) { console.log(state);});
or you can be more specific like this:
editor.viewModel.featureTemplatesViewModel.on("select", (x) => { console.log(x);});
editor.viewModel.featureTemplatesViewModel.on("select", (x) => { console.log(x);});is not working. I'm using JS API 4.28. What is the right property and right model to watch for?
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.