Event Listener for "Update" button in Editor Widget - JavaScript API

882
3
05-28-2019 11:57 PM
lxd
by
New Contributor III

I am using Javascript API for ArcGIS version 4. I have a map with one layer and Editor Widget where one value can be edited.

Is there a way to detect click on "update" button in the Editor Widget? I found the button class from web-page, but it seems to be a general name (<button class="esri-editor__control-button esri-button">Update</button>). 

3 Replies
DPT
by
New Contributor II

I am facing the same problem. Is there somebody who can help?

0 Kudos
MohammedZaki
New Contributor III

Any support with this, please? @ESRI1 

0 Kudos
MohammedZaki
New Contributor III

A workaround that I used is to override the default applyEdits method in the feature layer.

Code in typescript:

mapview.on('layerview-create', async (event) => {
      if (event.layer.type === 'feature') {
        const eventLayer = event.layer as FeatureLayer;
        eventLayer['defaultApplyEdits'] = eventLayer.applyEdits;
        eventLayer.applyEdits = function (
          edits: __esri.FeatureLayerBaseApplyEditsEdits
        ) {
          console.log(edits);
          // apply your logic here
          return this.get<Function>('defaultApplyEdits').apply(this, arguments);
        };
      }
    });

 

0 Kudos