Is there a way to configure feature symbol when highlighting them? I have written sample code here. See https://codepen.io/b2810s/pen/VwEEpbx .
However, it goes through the loop to configure the symbol with each feature. How can I avoid this loop? Consider the scenario where I need to highlight multiple features from multiple layers.
It was easier with ArcGIS Javascript API 3.x to configure the selection symbology with the feature layer. But I don't find similar with the 4.x.
Solved! Go to Solution.
Instead of adding GraphicsLayer, you can create a client-side FeatureLayer and set the renderer of the feature layer. This way you don't have assign a symbol to every single graphic. Take a look at this sample: https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=layers-featurelayer-coll...
4.x does not have concept of selection symbol. You can change the highlightOptions for the layer view. Please take a look this sample as this shows how to change the layer view's highlightOptions: https://developers.arcgis.com/javascript/latest/sample-code/highlightoptions-layerviews/
The reason I am adding Graphic object manually so I can display the symbology as per customer's preference. highlightOptions doesn't allow to display different symbols with different styles. Is there any plan to support it in future? Or any other alternatives for this scenario?
Instead of adding GraphicsLayer, you can create a client-side FeatureLayer and set the renderer of the feature layer. This way you don't have assign a symbol to every single graphic. Take a look at this sample: https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=layers-featurelayer-coll...
@UndralBatsukh This is a good suggestion and it will work for me, thanks!