Javascript API 4.X Clear Highlights

538
1
Jump to solution
04-01-2019 12:44 PM
ShawnRoberts1
Occasional Contributor

Hi all, I've got a custom web map that has a side table of the features available on the map. When the user hovers on one of the rows in the side table it highlights the related feature (or multiple) on the map. It's following the logic of  https://developers.arcgis.com/javascript/latest/sample-code/highlight-point-features/index.html, just modified to fit my use case. 

My question is there a more efficient way to remove all of the highlights every time than loop through and use highlight.remove(); ex is there a clear all highlights argument or something that I can pass into remove all highlights out of the layer.

Just looking for the cleanest way possible.

Thanks

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Esteemed Contributor

Sean,

   If multiple features are highlighted at the same time using some code like:

highlightSelect = layerView.highlight(
result.features
);‍‍‍

then

highlightSelect.remove();

will remove the highlight from all the features

View solution in original post

0 Kudos
1 Reply
RobertScheitlin__GISP
MVP Esteemed Contributor

Sean,

   If multiple features are highlighted at the same time using some code like:

highlightSelect = layerView.highlight(
result.features
);‍‍‍

then

highlightSelect.remove();

will remove the highlight from all the features

View solution in original post

0 Kudos