<?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 Re: Editor Widget: how to handle a new feature before it is added to its feature layer? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-widget-how-to-handle-a-new-feature-before/m-p/96841#M8887</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Take a look at the Feature Layer's &lt;A href="https://developers.arcgis.com/javascript/jsapi/featurelayer-amd.html#event-before-apply-edits"&gt;before-apply-edits&lt;/A&gt; event. This event fires before features are added to the feature layer. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 24 Jun 2015 00:18:47 GMT</pubDate>
    <dc:creator>KellyHutchins</dc:creator>
    <dc:date>2015-06-24T00:18:47Z</dc:date>
    <item>
      <title>Editor Widget: how to handle a new feature before it is added to its feature layer?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-widget-how-to-handle-a-new-feature-before/m-p/96840#M8886</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Hi everyone, the background is:&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;I have asked the similar question before. I think it might be confusing. Instead re-post in that thread, I think it is better to create a new thread.&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;I use the Template Picker Widget and the Editor Widget for online editing. While those two widgets are powerful and convenient, they give me some headaches in using them. My major headache is on attribute editing before the attribute inspector popup.&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;By investigating the objects/property/methods of the Editor object, I learned that the Editor widget has a built-in Draw toolbar, which can be referred as follows, I can add an event handler to the "draw-end" event.&lt;/P&gt;&lt;P style="padding-left: 30px; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;SPAN style="font-weight: inherit; font-family: inherit; font-style: inherit;"&gt;&lt;EM&gt;myEditor = new Editor(editor_params, 'myEditorDiv');&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;SPAN style="font-weight: inherit; font-family: inherit; font-style: inherit;"&gt;&lt;EM&gt;myEditor.startup();&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;SPAN style="font-weight: inherit; font-family: inherit; font-style: inherit;"&gt;&lt;EM&gt;myEditor.drawingToolbar.drawToolbar.on("draw-end", myDrawEnd_func);&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;SPAN style="font-weight: inherit; font-family: inherit; font-style: inherit;"&gt;&lt;STRONG&gt;drawingToolbar&lt;/STRONG&gt;&lt;/SPAN&gt; is an object of &lt;SPAN style="font-weight: inherit; font-family: inherit; font-style: inherit;"&gt;&lt;EM&gt;myEditor&lt;/EM&gt;&lt;/SPAN&gt;, and &lt;SPAN style="font-weight: inherit; font-family: inherit; font-style: inherit;"&gt;&lt;STRONG&gt;drawToolbar&lt;/STRONG&gt;&lt;/SPAN&gt; is an object of &lt;SPAN style="font-weight: inherit; font-family: inherit; font-style: inherit;"&gt;&lt;EM&gt;drawingToolbar&lt;/EM&gt;&lt;/SPAN&gt;object.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;I thought I can update the attribute information in the onDrawEnd event listener - &lt;SPAN style="font-family: inherit; font-weight: inherit;"&gt;&lt;EM&gt;myDrawEnd_func - &lt;/EM&gt;&lt;/SPAN&gt; before the feature is inserted into the feature layer. But I am wrong. I can't trap the newly created geometry in my event listener as the sample code at &lt;A href="https://developers.arcgis.com/javascript/jssamples/ed_feature_creation.html"&gt;this link (Edit without Editor Widget)&lt;/A&gt;.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;This is my code which I use to trap the new geometry and assign attribute information to the new geometry. This is the way to manipulate the new feature before it is added to the feature layer as the sample code: &lt;A href="https://developers.arcgis.com/javascript/jssamples/ed_feature_creation.html" style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Edit without Editor Widget&lt;/A&gt;.&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;But the problem is: there are two features added to the feature layer. One is with my customized attribute information. The other is without any customized information. I guess I do not really trap the feature before it is added to the feature layer in the "draw-end" event listener. Instead, I am re-creating the same feature and change the attribute information.&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;SPAN style="font-weight: inherit; font-family: inherit; font-style: inherit;"&gt;&lt;EM&gt;myEditor = new Editor(editor_params, 'myEditorDiv');&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;SPAN style="font-weight: inherit; font-family: inherit; font-style: inherit;"&gt;&lt;EM&gt;myEditor.startup();&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;SPAN style="font-weight: inherit; font-family: inherit; font-style: inherit;"&gt;&lt;EM&gt;myEditor.drawingToolbar.drawToolbar.on("draw-end", function(evt){&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;SPAN style="font-weight: inherit; font-family: inherit; font-style: inherit;"&gt;&lt;EM&gt;&amp;nbsp; var myPoint = new Graphic(evt.geometry, null, null, null);&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;SPAN style="font-weight: inherit; font-family: inherit; font-style: inherit;"&gt;&lt;EM&gt;&amp;nbsp; myPoint .attributes = some_attr;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // some_attr: from other function&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 60px; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;SPAN style="font-weight: inherit; font-family: inherit;"&gt;&lt;EM&gt;&amp;nbsp; myFeatureLayer.applyEdits([myPoint ], null, null);&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;SPAN style="font-weight: inherit; font-family: inherit; font-style: inherit;"&gt;&lt;EM&gt;});&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;My question is:&lt;SPAN style="color: #e23d39;"&gt;&lt;STRONG&gt; for the built-in toolbar, &lt;SPAN style="font-family: inherit; font-weight: inherit;"&gt;&lt;EM&gt;myEditor.drawingToolbar.drawToolbar,&lt;/EM&gt;&lt;/SPAN&gt; of the Editor Widget, can I trap the new feature in the "draw-end" event listener&amp;nbsp; before the feature is added to its feature layer?&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jun 2015 14:35:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-widget-how-to-handle-a-new-feature-before/m-p/96840#M8886</guid>
      <dc:creator>xiannianchen</dc:creator>
      <dc:date>2015-06-19T14:35:46Z</dc:date>
    </item>
    <item>
      <title>Re: Editor Widget: how to handle a new feature before it is added to its feature layer?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-widget-how-to-handle-a-new-feature-before/m-p/96841#M8887</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Take a look at the Feature Layer's &lt;A href="https://developers.arcgis.com/javascript/jsapi/featurelayer-amd.html#event-before-apply-edits"&gt;before-apply-edits&lt;/A&gt; event. This event fires before features are added to the feature layer. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jun 2015 00:18:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/editor-widget-how-to-handle-a-new-feature-before/m-p/96841#M8887</guid>
      <dc:creator>KellyHutchins</dc:creator>
      <dc:date>2015-06-24T00:18:47Z</dc:date>
    </item>
  </channel>
</rss>

