<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Betreff: editor widget: how to listen to &amp;quot;delete&amp;quot; event in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-widget-how-to-listen-to-quot-delete-quot/m-p/1216639#M78833</link>
    <description>&lt;P&gt;thanks for the response. But the documentation clearly states:&lt;/P&gt;&lt;P&gt;"Fires after &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#applyEdits" target="_blank"&gt;applyEdits()&lt;/A&gt; is completed successfully."&lt;/P&gt;&lt;P&gt;I don't want to "applyEdits" first, which writes something into my service and then remove it again as it might not be validated successfully.&lt;/P&gt;</description>
    <pubDate>Tue, 27 Sep 2022 18:00:31 GMT</pubDate>
    <dc:creator>RiccardoKlinger</dc:creator>
    <dc:date>2022-09-27T18:00:31Z</dc:date>
    <item>
      <title>editor widget: how to listen to "delete" event</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-widget-how-to-listen-to-quot-delete-quot/m-p/1212476#M78712</link>
      <description>&lt;P&gt;I am using the editor widget and would like to call some validation process before I apply my edits. this works fine, listening to the submit event.&lt;/P&gt;&lt;P&gt;But this "submit" event is not called when I press the delete button. How can I call a validation in case of a delete statement? here is a sample code:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;&amp;lt;html&amp;gt;

&amp;lt;head&amp;gt;
  &amp;lt;meta charset="utf-8"&amp;gt;
  &amp;lt;meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no"&amp;gt;
  &amp;lt;title&amp;gt;Edit features with the Editor widget | Sample | ArcGIS API for JavaScript 4.24&amp;lt;/title&amp;gt;

  &amp;lt;link rel="stylesheet" href="https://js.arcgis.com/4.24/esri/themes/light/main.css" /&amp;gt;
  &amp;lt;script src="https://js.arcgis.com/4.24/"&amp;gt;&amp;lt;/script&amp;gt;

  &amp;lt;style&amp;gt;
    html,
    body,
    #viewDiv {
      padding: 0;
      margin: 0;
      height: 100%;
      width: 100%;
    }

    .esri-editor .esri-item-list__scroller {
      max-height: 350px;
    }
  &amp;lt;/style&amp;gt;

  &amp;lt;script&amp;gt;
    require([
        "esri/WebMap",
        "esri/views/MapView",
        "esri/widgets/Editor"
      ], (
        WebMap, MapView,
        Editor
      ) =&amp;gt; {

        let pointLayer, lineLayer, polygonLayer;

        // Create a map from the referenced webmap item id
        const webmap = new WebMap({
          portalItem: {
            id: "459a495fc16d4d4caa35e92e895694c8"
          }
        });

        const view = new MapView({
          container: "viewDiv",
          map: webmap
        });

        view.when(() =&amp;gt; {
          view.map.loadAll().then(() =&amp;gt; {
            view.map.allLayers.forEach((layer) =&amp;gt; {
              if (layer.type === 'feature') {
                switch (layer.geometryType) {
                  case "polygon":
                    polygonLayer = layer;
                    break;
                }
              }
            });
            const polyInfos = {
              layer: polygonLayer,
              formTemplate: { // autocasts to FormTemplate
                elements: [{ // autocasts to FieldElement
                  type: "field",
                  fieldName: "incidenttype",
                  label: "Incident Type"
                }, {
                  type: "field",
                  fieldName: "activeincid",
                  label: "Active"
                }, {
                  type: "field",
                  fieldName: "descrip",
                  label: "Description"
                }]
              }
          };

            const editor = new Editor({
              view: view,
              layerInfos: [polyInfos]
          });

          editor.viewModel.featureFormViewModel.on("submit", function(){


    const updated = editor.viewModel.featureFormViewModel.getValues();
    console.log(updated)
    const edits = {
      updateFeatures: [editFeature]
    };
    //applyEdits(edits);
});
          editor.viewModel.watch("state", function(
            newValue,
            oldValue,
            propertyName,
            target
            ) {
            console.log(target,  propertyName + " changed from " + oldValue + " to " + newValue, editor.viewModel)
            });
          // Add the widget to the view
          view.ui.add(editor, "top-right");
          });
        });
      });
  &amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;body&amp;gt;
  &amp;lt;div id="viewDiv"&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;

&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2022 15:26:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-widget-how-to-listen-to-quot-delete-quot/m-p/1212476#M78712</guid>
      <dc:creator>RiccardoKlinger</dc:creator>
      <dc:date>2022-09-14T15:26:26Z</dc:date>
    </item>
    <item>
      <title>Betreff: editor widget: how to listen to "delete" event</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-widget-how-to-listen-to-quot-delete-quot/m-p/1213989#M78749</link>
      <description>&lt;P&gt;I'm really not an expert (just started learning about the api myself), but I guess you could use the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#event-edits" target="_self"&gt;"edits"-event&lt;/A&gt; of the feature layer:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;polygonLayer.on("edits", function (event) {
  if (event.deletedFeatures.length &amp;gt; 0) {
    console.log("Do stuff");
  }
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2022 21:24:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-widget-how-to-listen-to-quot-delete-quot/m-p/1213989#M78749</guid>
      <dc:creator>MatthiasKl</dc:creator>
      <dc:date>2022-09-19T21:24:53Z</dc:date>
    </item>
    <item>
      <title>Betreff: editor widget: how to listen to "delete" event</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-widget-how-to-listen-to-quot-delete-quot/m-p/1216639#M78833</link>
      <description>&lt;P&gt;thanks for the response. But the documentation clearly states:&lt;/P&gt;&lt;P&gt;"Fires after &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#applyEdits" target="_blank"&gt;applyEdits()&lt;/A&gt; is completed successfully."&lt;/P&gt;&lt;P&gt;I don't want to "applyEdits" first, which writes something into my service and then remove it again as it might not be validated successfully.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2022 18:00:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-widget-how-to-listen-to-quot-delete-quot/m-p/1216639#M78833</guid>
      <dc:creator>RiccardoKlinger</dc:creator>
      <dc:date>2022-09-27T18:00:31Z</dc:date>
    </item>
  </channel>
</rss>

