<?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 Javascript API 4.2X Removing highlight from a specific feature (not all features) in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-api-4-2x-removing-highlight-from-a/m-p/1120941#M75422</link>
    <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;I am using the highlight method (&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-FeatureLayerView.html#highlight," target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-FeatureLayerView.html#highlight,&lt;/A&gt; &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/highlight-point-features/" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/sample-code/highlight-point-features/&lt;/A&gt;) on the map view to highlight individual points one by one based on user input from another part of my application.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;highlighted = mapView.highlight(feature);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Given that there are multiple features highlighted, is there a way to selectively remove the highlight from a feature (perhaps using the ObjectId or attribute) without removing the highlight from all of the features?&lt;/P&gt;&lt;P&gt;Every example that I've seen so far suggests removing &lt;EM&gt;all&lt;/EM&gt; of the highlights and then creating a new highlight with the new graphic or array of graphics, like so.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if (highlighted) {
     highlighted.remove();
}

highlighted = mapView.highlight(feature);  // new graphic or array of graphics&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This technically works, but it creates an undesirable effect where the highlighted features briefly flash before showing the new highlighted selection. If possible, I do not want the highlighted features to flash when removing/updating a highlight.&lt;/P&gt;&lt;P&gt;I've been looking into this for a while now and haven't found a solution. I'm hoping there is some way to do it. It looks possible because the Feature Table widget has a &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable.html#highlightOnRowSelectEnabled" target="_self"&gt;highlightOnRowSelectEnabled&lt;/A&gt; property, and that works smoothly when adding/removing highlights, but I don't know if any part of that is transferable here.&lt;/P&gt;&lt;P&gt;Any help is much appreciated. Thanks in advance!&lt;/P&gt;</description>
    <pubDate>Mon, 29 Nov 2021 19:33:45 GMT</pubDate>
    <dc:creator>ShellyM</dc:creator>
    <dc:date>2021-11-29T19:33:45Z</dc:date>
    <item>
      <title>Javascript API 4.2X Removing highlight from a specific feature (not all features)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-api-4-2x-removing-highlight-from-a/m-p/1120941#M75422</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;I am using the highlight method (&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-FeatureLayerView.html#highlight," target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-FeatureLayerView.html#highlight,&lt;/A&gt; &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/highlight-point-features/" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/sample-code/highlight-point-features/&lt;/A&gt;) on the map view to highlight individual points one by one based on user input from another part of my application.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;highlighted = mapView.highlight(feature);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Given that there are multiple features highlighted, is there a way to selectively remove the highlight from a feature (perhaps using the ObjectId or attribute) without removing the highlight from all of the features?&lt;/P&gt;&lt;P&gt;Every example that I've seen so far suggests removing &lt;EM&gt;all&lt;/EM&gt; of the highlights and then creating a new highlight with the new graphic or array of graphics, like so.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if (highlighted) {
     highlighted.remove();
}

highlighted = mapView.highlight(feature);  // new graphic or array of graphics&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This technically works, but it creates an undesirable effect where the highlighted features briefly flash before showing the new highlighted selection. If possible, I do not want the highlighted features to flash when removing/updating a highlight.&lt;/P&gt;&lt;P&gt;I've been looking into this for a while now and haven't found a solution. I'm hoping there is some way to do it. It looks possible because the Feature Table widget has a &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable.html#highlightOnRowSelectEnabled" target="_self"&gt;highlightOnRowSelectEnabled&lt;/A&gt; property, and that works smoothly when adding/removing highlights, but I don't know if any part of that is transferable here.&lt;/P&gt;&lt;P&gt;Any help is much appreciated. Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Mon, 29 Nov 2021 19:33:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-api-4-2x-removing-highlight-from-a/m-p/1120941#M75422</guid>
      <dc:creator>ShellyM</dc:creator>
      <dc:date>2021-11-29T19:33:45Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript API 4.2X Removing highlight from a specific feature (not all features)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-api-4-2x-removing-highlight-from-a/m-p/1121111#M75428</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Have you tried to highlight all the relevant features again minus the one you want to remove the highlight for?&lt;/P&gt;</description>
      <pubDate>Tue, 30 Nov 2021 02:30:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-api-4-2x-removing-highlight-from-a/m-p/1121111#M75428</guid>
      <dc:creator>shaylavi</dc:creator>
      <dc:date>2021-11-30T02:30:17Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript API 4.2X Removing highlight from a specific feature (not all features)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-api-4-2x-removing-highlight-from-a/m-p/1121130#M75431</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/335589"&gt;@shaylavi&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;Thanks for your reply. Yes, I have tried to call highlight again on the modified array. Added features get highlighted just fine, but any features that I remove from the array stay highlighted on the map (hence the need to remove all existing highlights before calling highlight again, but then this causes the flashing).&lt;/P&gt;</description>
      <pubDate>Tue, 30 Nov 2021 05:19:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-api-4-2x-removing-highlight-from-a/m-p/1121130#M75431</guid>
      <dc:creator>ShellyM</dc:creator>
      <dc:date>2021-11-30T05:19:31Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript API 4.2X Removing highlight from a specific feature (not all features)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-api-4-2x-removing-highlight-from-a/m-p/1121142#M75433</link>
      <description>&lt;P&gt;Well, I haven't checked this myself but my guess is that when features are highlighted, it's a new separated graphic layer created, which you can access and modify manually. Once you are able to validate this, your next issue would probably be to recognise the right point you would like to remove, which surely can be solved easily with a filter based on an attribute. Hope that make sense&lt;/P&gt;</description>
      <pubDate>Tue, 30 Nov 2021 06:52:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-api-4-2x-removing-highlight-from-a/m-p/1121142#M75433</guid>
      <dc:creator>shaylavi</dc:creator>
      <dc:date>2021-11-30T06:52:36Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript API 4.2X Removing highlight from a specific feature (not all features)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-api-4-2x-removing-highlight-from-a/m-p/1121846#M75454</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/335589"&gt;@shaylavi&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Thanks. Your explanation makes sense, but how do I access the separated graphic layer that was created so that I can query it for the right point? I don't have a reference to the layer, I don't know the ID, and it doesn't show up when I loop through all layers (I'm sure I'm overlooking something here).&lt;/P&gt;</description>
      <pubDate>Wed, 01 Dec 2021 19:50:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-api-4-2x-removing-highlight-from-a/m-p/1121846#M75454</guid>
      <dc:creator>ShellyM</dc:creator>
      <dc:date>2021-12-01T19:50:33Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript API 4.2X Removing highlight from a specific feature (not all features)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-api-4-2x-removing-highlight-from-a/m-p/1121990#M75458</link>
      <description>&lt;P&gt;I had a look at the API and you can use the following example -&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;view.allLayerViews.items[2]._highlightIds.delete(7423)&lt;/LI-CODE&gt;&lt;P&gt;item #2 is the feature layer object - in your case, you'll need to recognise the right layer in the array of allLayersViews. You can do that in many way (hard coded like in my example would be the worse option.&lt;/P&gt;&lt;P&gt;Once you have the layer object available, you could have access to an object called _highlightIds which contains a map of all highlighted features. This array has a delete function that you pass an objectId you would like to remove as highlighted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Dec 2021 23:17:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-api-4-2x-removing-highlight-from-a/m-p/1121990#M75458</guid>
      <dc:creator>shaylavi</dc:creator>
      <dc:date>2021-12-01T23:17:15Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript API 4.2X Removing highlight from a specific feature (not all features)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-api-4-2x-removing-highlight-from-a/m-p/1122024#M75459</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/335589"&gt;@shaylavi&lt;/a&gt;, that worked! Great! A BIG thank you! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I had to use _updateHighlight after removing the feature in order to see the change on the map.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const layer = view.allLayerViews.items.filter(d =&amp;gt; d.layer.id === 'layer-id')[0]

layer._highlightIds.delete(id)  // feature - object id
layer._updateHighlight();&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Dec 2021 02:10:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-api-4-2x-removing-highlight-from-a/m-p/1122024#M75459</guid>
      <dc:creator>ShellyM</dc:creator>
      <dc:date>2021-12-02T02:10:13Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript API 4.2X Removing highlight from a specific feature (not all features)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-api-4-2x-removing-highlight-from-a/m-p/1122042#M75460</link>
      <description>&lt;P&gt;Cool, glad I could help&lt;/P&gt;</description>
      <pubDate>Thu, 02 Dec 2021 02:53:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-api-4-2x-removing-highlight-from-a/m-p/1122042#M75460</guid>
      <dc:creator>shaylavi</dc:creator>
      <dc:date>2021-12-02T02:53:35Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript API 4.2X Removing highlight from a specific feature (not all features)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-api-4-2x-removing-highlight-from-a/m-p/1319506#M82002</link>
      <description>&lt;P&gt;I was going through the same issue and I did it like this. hope this will be helpful for many. basic idea I took from shaylavi's code. Thanks man.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;this.appConfig.activeView.allLayerViews.items.forEach((item:any) =&amp;gt; {
              if (item &amp;amp;&amp;amp; item._highlightIds) {
                item._highlightIds.clear();
              }
            });

            let results = event.results.filter((result:any) =&amp;gt; {
              if (result.graphic.layer.type === "feature") {
                return result;
              }
            });

            results.forEach((result:any) =&amp;gt; {
              if (result) {
                this.layerViewCollection.forEach((layerView:any) =&amp;gt; {
                  if (layerView.layer === result.graphic.layer) {
                    const highlightGraphic = layerView.highlight(result.graphic.clone());
                    this.appConfig.activeView.graphics.add(highlightGraphic);
                    this.highlights.push(highlightGraphic);

                    const feature = result.graphic;
                    popup.open({
                      location: event.mapPoint,
                      features: [feature],
                    });
                  }
                });
              }
            });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2023 10:41:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-api-4-2x-removing-highlight-from-a/m-p/1319506#M82002</guid>
      <dc:creator>UbaidGul6402</dc:creator>
      <dc:date>2023-08-17T10:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript API 4.2X Removing highlight from a specific feature (not all features)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-api-4-2x-removing-highlight-from-a/m-p/1319566#M82005</link>
      <description>&lt;P&gt;Today I'd recommend using the&amp;nbsp;includedEffect (see link below) on a point layer that will highlight the clicked points and have a second points layer with the same symbology to make sure excluded/unclicked points will remain the same.. this is a faster and cheaper way to highlight points.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-FeatureEffect.html" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-FeatureEffect.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2023 13:13:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-api-4-2x-removing-highlight-from-a/m-p/1319566#M82005</guid>
      <dc:creator>shaylavi</dc:creator>
      <dc:date>2023-08-17T13:13:15Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript API 4.2X Removing highlight from a specific feature (not all features)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-api-4-2x-removing-highlight-from-a/m-p/1319647#M82010</link>
      <description>&lt;P&gt;The API is changing quickly so I appreciate the follow-up reply&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/335589"&gt;@shaylavi&lt;/a&gt;!&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2023 15:23:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/javascript-api-4-2x-removing-highlight-from-a/m-p/1319647#M82010</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2023-08-17T15:23:23Z</dc:date>
    </item>
  </channel>
</rss>

