<?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: Only display the latest feature added in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/only-display-the-latest-feature-added/m-p/436111#M40157</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks! That appears to have resolved the issue.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Nevermind about the last comment... I've solved it by changing the visibility of the layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-size:1;"&gt;One minor problem still. When the map is loaded it is displaying all of the features.&amp;nbsp; When I add a feature to the layer all of the features disappear except the newly added feature.&amp;nbsp; Is there anyway to show no features when the map has loaded, and then once one is added display only the newly added feature?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 04 Mar 2014 15:59:41 GMT</pubDate>
    <dc:creator>HenryBoston</dc:creator>
    <dc:date>2014-03-04T15:59:41Z</dc:date>
    <item>
      <title>Only display the latest feature added</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/only-display-the-latest-feature-added/m-p/436107#M40153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm trying to modify the following sample to only show the latest feature added to the map.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The sample is located here: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://developers.arcgis.com/javascript/jssamples/ed_attributeInspectorValidate.html" rel="nofollow" target="_blank"&gt;https://developers.arcgis.com/javascript/jssamples/ed_attributeInspectorValidate.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've tried to change&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;//Add the editable feature layer to the map &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var pointsOfInterest = new esri.layers.FeatureLayer("http://sampleserver5.arcgisonline.com/ArcGIS/rest/services/Notes/FeatureServer/0",{ &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mode: esri.layers.FeatureLayer.MODE_ONDEMAND,&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outFields: ['*'] &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;from MODE_ONDEMAND to MODE_SELECTION&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;//Add the editable feature layer to the map &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var pointsOfInterest = new esri.layers.FeatureLayer("http://sampleserver5.arcgisonline.com/ArcGIS/rest/services/Notes/FeatureServer/0",{ &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mode: esri.layers.FeatureLayer.MODE_SELECTION,&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outFields: ['*'] &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Which works when adding a new feature but as soon as the user clicks anywhere else on the map the newly added feature disappears.&amp;nbsp; Is there anyway to modify the code so that the newly added feature remains displayed until another feature is added? Effectively making it so only the latest feature is shown on the map.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Feb 2014 17:22:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/only-display-the-latest-feature-added/m-p/436107#M40153</guid>
      <dc:creator>HenryBoston</dc:creator>
      <dc:date>2014-02-28T17:22:15Z</dc:date>
    </item>
    <item>
      <title>Re: Only display the latest feature added</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/only-display-the-latest-feature-added/m-p/436108#M40154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Henry,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The 'edits-complete' event returns the object id of the new feature. Use this value to set the definition expression of the layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;featureLayer.setDefinitionExpression("OBJECTID = " + THE_RETURNED_OBJECTID);&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've not tried this on layer while editing, but I think it should work fine.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 01 Mar 2014 21:05:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/only-display-the-latest-feature-added/m-p/436108#M40154</guid>
      <dc:creator>BenFousek</dc:creator>
      <dc:date>2014-03-01T21:05:11Z</dc:date>
    </item>
    <item>
      <title>Re: Only display the latest feature added</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/only-display-the-latest-feature-added/m-p/436109#M40155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the response Ben. I think we are heading in the right direction. However whenever the edit is complete it hides all of the features including the recently added one.&amp;nbsp; Below is my code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; dojo.connect(pointsOfInterest, "onEditsComplete", function(a, u, d) { 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var objectId = a;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(objectId);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pointsOfInterest.setDefinitionExpression("OBJECTID = " + objectId);

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:32:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/only-display-the-latest-feature-added/m-p/436109#M40155</guid>
      <dc:creator>HenryBoston</dc:creator>
      <dc:date>2021-12-11T19:32:32Z</dc:date>
    </item>
    <item>
      <title>Re: Only display the latest feature added</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/only-display-the-latest-feature-added/m-p/436110#M40156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;dojo.connect(pointsOfInterest, "onEditsComplete", function (a, u, d) { &amp;nbsp; var objectId = a[0].objectId; &amp;nbsp; pointsOfInterest.setDefinitionExpression("OBJECTID = " + objectId); &amp;nbsp; pointsOfInterest.refresh(); //for good measure });&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, consider switching to AMD sooner than later.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Mar 2014 15:50:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/only-display-the-latest-feature-added/m-p/436110#M40156</guid>
      <dc:creator>BenFousek</dc:creator>
      <dc:date>2014-03-04T15:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: Only display the latest feature added</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/only-display-the-latest-feature-added/m-p/436111#M40157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks! That appears to have resolved the issue.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Nevermind about the last comment... I've solved it by changing the visibility of the layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-size:1;"&gt;One minor problem still. When the map is loaded it is displaying all of the features.&amp;nbsp; When I add a feature to the layer all of the features disappear except the newly added feature.&amp;nbsp; Is there anyway to show no features when the map has loaded, and then once one is added display only the newly added feature?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Mar 2014 15:59:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/only-display-the-latest-feature-added/m-p/436111#M40157</guid>
      <dc:creator>HenryBoston</dc:creator>
      <dc:date>2014-03-04T15:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: Only display the latest feature added</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/only-display-the-latest-feature-added/m-p/436112#M40158</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You're welcome. Happy coding!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Mar 2014 16:06:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/only-display-the-latest-feature-added/m-p/436112#M40158</guid>
      <dc:creator>BenFousek</dc:creator>
      <dc:date>2014-03-04T16:06:49Z</dc:date>
    </item>
  </channel>
</rss>

