Select to view content in your preferred language

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

1135
3
05-28-2019 11:57 PM
lxd
by
Regular Contributor

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
Emerging Contributor

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

0 Kudos
MohammedZaki
Occasional Contributor

Any support with this, please? @ESRI1 

0 Kudos
MohammedZaki
Occasional Contributor

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