<?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: How can I edit a feature in 4.x like I did with esri/toolbars/edit in 3.x? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-edit-a-feature-in-4-x-like-i-did-with/m-p/1161339#M76926</link>
    <description>&lt;P&gt;Moving a single feature seems pretty straightforward with 4.x. Have you seen &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/widgets-editor-basic/" target="_self"&gt;this demo&lt;/A&gt; of the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor.html" target="_self"&gt;Editor Widget&lt;/A&gt;? It got some major updates in the 4.23 release.&lt;/P&gt;</description>
    <pubDate>Tue, 05 Apr 2022 19:35:06 GMT</pubDate>
    <dc:creator>BlakeTerhune</dc:creator>
    <dc:date>2022-04-05T19:35:06Z</dc:date>
    <item>
      <title>How can I edit a feature in 4.x like I did with esri/toolbars/edit in 3.x?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-edit-a-feature-in-4-x-like-i-did-with/m-p/1161243#M76920</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm building a very custom application with 4.x and I'm struggling with duplicating functionality that I have in my current 3.x application.&lt;/P&gt;&lt;P&gt;Here's what I want to be able to do:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Select a feature&lt;/LI&gt;&lt;LI&gt;Enable "move mode" where I can move&amp;nbsp;&lt;EM&gt;just that one feature&lt;/EM&gt;&lt;/LI&gt;&lt;LI&gt;Save changes&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Watch &lt;A href="https://zipmessage.com/utilisync/51bdbd5f0e2039bff95d3bf3d" target="_self"&gt;this short screencast&lt;/A&gt; to see what I mean.&lt;/P&gt;&lt;P&gt;In 3.x that was super easy to do using the edit toolbar, like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;editToolbar = new Edit(map);
//Once the feature is selected
editToolbar.activate(Edit.MOVE | Edit.SCALE | Edit.EDIT_VERTICES, feature);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I do the same thing in 4.x?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2022 16:46:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-edit-a-feature-in-4-x-like-i-did-with/m-p/1161243#M76920</guid>
      <dc:creator>MattStayner</dc:creator>
      <dc:date>2022-04-05T16:46:46Z</dc:date>
    </item>
    <item>
      <title>Re: How can I edit a feature in 4.x like I did with esri/toolbars/edit in 3.x?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-edit-a-feature-in-4-x-like-i-did-with/m-p/1161339#M76926</link>
      <description>&lt;P&gt;Moving a single feature seems pretty straightforward with 4.x. Have you seen &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/widgets-editor-basic/" target="_self"&gt;this demo&lt;/A&gt; of the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor.html" target="_self"&gt;Editor Widget&lt;/A&gt;? It got some major updates in the 4.23 release.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2022 19:35:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-edit-a-feature-in-4-x-like-i-did-with/m-p/1161339#M76926</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2022-04-05T19:35:06Z</dc:date>
    </item>
    <item>
      <title>Re: How can I edit a feature in 4.x like I did with esri/toolbars/edit in 3.x?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-edit-a-feature-in-4-x-like-i-did-with/m-p/1161416#M76931</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/191789"&gt;@BlakeTerhune&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Thanks for the response, and thanks for pointing me back to the Editor widget demo! I saw it before, but I couldn't see how to move features. Now I see... you have to click &lt;STRONG&gt;Select&lt;/STRONG&gt;&amp;nbsp;under &lt;STRONG&gt;Edit Features&lt;/STRONG&gt;. Once I do that, and select a feature, then it does exactly what I want.&lt;/P&gt;&lt;P&gt;If I go with that solution, I'm still stuck with using the Editor widget, which doesn't really fit into my flow. Is there a way I can use that tool, but hide the widget and pass in the feature before I start it?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;</description>
      <pubDate>Tue, 05 Apr 2022 22:49:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-edit-a-feature-in-4-x-like-i-did-with/m-p/1161416#M76931</guid>
      <dc:creator>MattStayner</dc:creator>
      <dc:date>2022-04-05T22:49:02Z</dc:date>
    </item>
    <item>
      <title>Re: How can I edit a feature in 4.x like I did with esri/toolbars/edit in 3.x?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-edit-a-feature-in-4-x-like-i-did-with/m-p/1161611#M76936</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/377011"&gt;@MattStayner&lt;/a&gt;&amp;nbsp;wrote:&lt;P&gt;If I go with that solution, I'm still stuck with using the Editor widget, which doesn't really fit into my flow. Is there a way I can use that tool, but hide the widget and pass in the feature before I start it?&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Possibly, but I haven't worked with editing in 4.x yet so I really can't advise how to go about customizing that functionality. Hopefully someone else with more experience can contribute to this conversation.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2022 15:10:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-edit-a-feature-in-4-x-like-i-did-with/m-p/1161611#M76936</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2022-04-06T15:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: How can I edit a feature in 4.x like I did with esri/toolbars/edit in 3.x?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-edit-a-feature-in-4-x-like-i-did-with/m-p/1161764#M76939</link>
      <description>&lt;P&gt;The key here is using the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html" target="_self"&gt;SketchViewModel&lt;/A&gt; module.&amp;nbsp; This is admittedly brief, but here's the basic flow:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Get reference to graphic you want to edit.&lt;/LI&gt;&lt;LI&gt;If you haven't already instantiated a &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-GraphicsLayer.html" target="_self"&gt;GraphicsLayer&lt;/A&gt; for editing purposes, create one and add it to the view.&lt;/LI&gt;&lt;LI&gt;If you haven't already instantiated a &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html" target="_self"&gt;SketchViewModel&lt;/A&gt;, create one, assigning the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html#layer" target="_self"&gt;layer&lt;/A&gt; and &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html#view" target="_self"&gt;view&lt;/A&gt; properties in the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html#constructors-summary" target="_self"&gt;constructor&lt;/A&gt;. (Set the GraphicsLayer in the previous step to the layer property.)&amp;nbsp; Also recommend setting the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html#updateOnGraphicClick" target="_self"&gt;updateGraphicOnClick&lt;/A&gt; property in the constructor too.&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html#clone" target="_self"&gt;Clone&lt;/A&gt; the graphic and add it to your GraphicsLayer.&lt;/LI&gt;&lt;LI&gt;Make the original graphic invisible by &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#layerViews" target="_self"&gt;getting a reference to its associated layer's layerView&lt;/A&gt;, and calling layerView.setVisibility(graphic.&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html#getObjectId" target="_self"&gt;getObjectID&lt;/A&gt;(), false).&amp;nbsp; Note: setVisibility is an undocumented function.&lt;/LI&gt;&lt;LI&gt;Call SketchViewModel.&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html#update" target="_self"&gt;update&lt;/A&gt; on the cloned graphic, with the appropriate updateOptions (2nd parameter) set.&lt;/LI&gt;&lt;LI&gt;When the user has somehow signaled they are done editing, get the updated graphic from &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html#updateGraphics" target="_self"&gt;updateGraphics&lt;/A&gt;.&lt;/LI&gt;&lt;LI&gt;Assign the cloned graphic's geometry to the original graphic reference (see step 1).&lt;/LI&gt;&lt;LI&gt;Call &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#applyEdits" target="_self"&gt;applyEdits&lt;/A&gt; with the original graphic.&lt;/LI&gt;&lt;LI&gt;After the layer has refreshed, &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html#cancel" target="_self"&gt;cancel&lt;/A&gt; the SketchViewModel and&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-GraphicsLayer.html#removeAll" target="_self"&gt;clear&lt;/A&gt; the GraphicsLayer.&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Wed, 06 Apr 2022 18:42:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-edit-a-feature-in-4-x-like-i-did-with/m-p/1161764#M76939</guid>
      <dc:creator>JoelBennett</dc:creator>
      <dc:date>2022-04-06T18:42:04Z</dc:date>
    </item>
    <item>
      <title>Re: How can I edit a feature in 4.x like I did with esri/toolbars/edit in 3.x?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-edit-a-feature-in-4-x-like-i-did-with/m-p/1161798#M76940</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/6522"&gt;@JoelBennett&lt;/a&gt;&amp;nbsp;This looks like just what I need. It is a bit convoluted (coping graphics to other layer and back again), but if it works, that's OK. I will give it a go and report back here on my results. Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2022 19:31:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-edit-a-feature-in-4-x-like-i-did-with/m-p/1161798#M76940</guid>
      <dc:creator>MattStayner</dc:creator>
      <dc:date>2022-04-06T19:31:53Z</dc:date>
    </item>
    <item>
      <title>Re: How can I edit a feature in 4.x like I did with esri/toolbars/edit in 3.x?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-edit-a-feature-in-4-x-like-i-did-with/m-p/1162363#M76955</link>
      <description>&lt;P&gt;Convoluted it is, but it's the nature of the way things work in 4.x now that FeatureLayer no longer exposes a graphics property.&amp;nbsp; This workflow is largely how the 4.x Editor widget works behind the scenes too.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Apr 2022 23:40:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-edit-a-feature-in-4-x-like-i-did-with/m-p/1162363#M76955</guid>
      <dc:creator>JoelBennett</dc:creator>
      <dc:date>2022-04-07T23:40:56Z</dc:date>
    </item>
    <item>
      <title>Re: How can I edit a feature in 4.x like I did with esri/toolbars/edit in 3.x?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-edit-a-feature-in-4-x-like-i-did-with/m-p/1165617#M77045</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/6522"&gt;@JoelBennett&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I can't seem to get&amp;nbsp;sketchViewModel working. I do something like this:&lt;/P&gt;&lt;PRE&gt;const updateOptions = { tool: "move" };&lt;BR /&gt;const newGraphic = graphic.clone();&lt;BR /&gt;graphic.visible = false;&lt;BR /&gt;await sketchViewModel.update([newGraphic], updateOptions);&lt;BR /&gt;graphic.geometry = this.view.toMap(e);&lt;/PRE&gt;&lt;P&gt;But I keep getting this error:&lt;/P&gt;&lt;PRE&gt;SketchViewModel.js:51 Uncaught (in promise) TypeError: h.remove is not a function&lt;BR /&gt;    at f.n._setupUpdateOperation (SketchViewModel.js:51:462)&lt;BR /&gt;    at f.n.update (SketchViewModel.js:18:246)&lt;/PRE&gt;&lt;P&gt;Any thoughts/help on what I'm doing wrong?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 13:05:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-edit-a-feature-in-4-x-like-i-did-with/m-p/1165617#M77045</guid>
      <dc:creator>MattStayner</dc:creator>
      <dc:date>2022-04-19T13:05:00Z</dc:date>
    </item>
    <item>
      <title>Re: How can I edit a feature in 4.x like I did with esri/toolbars/edit in 3.x?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-edit-a-feature-in-4-x-like-i-did-with/m-p/1165796#M77053</link>
      <description>&lt;P&gt;This would suggest that the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html#layer" target="_self"&gt;layer&lt;/A&gt; property of the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Sketch-SketchViewModel.html" target="_self"&gt;SketchViewModel&lt;/A&gt; has not been set.&amp;nbsp; Please see step 3 of the process given previously.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 18:22:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-can-i-edit-a-feature-in-4-x-like-i-did-with/m-p/1165796#M77053</guid>
      <dc:creator>JoelBennett</dc:creator>
      <dc:date>2022-04-19T18:22:38Z</dc:date>
    </item>
  </channel>
</rss>

