I'm having some issues with highlighting graphics in ArcGis API for JS version 4.10. I've got a few different data sets that I'm working with. One data set is coming directly from an arcgis map server. The others are coming from web services that just have a latitude and longitude.
For the arcgis map server data set I am just passing the url as a property to a feature layer and using the highlight function of the feature layer view for mouse over highlights. This method works great and there is no flickering.
For the other web services, I am looping through the results and building an array of graphics, which I then add to the layer.
1. Using the highlight function on a GraphicsLayerView. This method doesn't do anything. I've tried adding an object id attribute to each graphic, but this still doesn't work.
2. Using the highlight function on a FeatureLayerView. This method works, but the highlight flickers when I move the mouse out of the graphic. I've noticed that this issue only occurs if you pass an array of graphics to the source property of the feature layer. The highlighting works without any flickering for the feature layer that is initialized with a url pointing to the arcgis map server. The actual highlighting logic is the same for these two feature layers, so I'm not sure why the one with a url is working and the one with an array of graphics has the flikering.
Below is the pseudo code for the graphics layer method.
Below is the pseudo code for the feature layer method.
Solved! Go to Solution.
Hi there,
Are you adding your data to 2D MapView? Highlight function does not work in 2D at 4.10 as it is 3D only function. This limitation was removed at 4.12. Can you use version 4.12?
-Undral
Hi there,
Are you adding your data to 2D MapView? Highlight function does not work in 2D at 4.10 as it is 3D only function. This limitation was removed at 4.12. Can you use version 4.12?
-Undral
I was able to use version 4.12 and that fixed the issue! Thank you!
Hi,
Sorry I'm resurrecting this question. We recently upgraded to 4.13 and found that our Graphics layer highlighting is no longer working again, even if I add an objectID attribute. If I downgrade back to 4.12 the highlighting works without changing any code. Is there something I need to do differently, in 4.13, to get the graphics layer highlighting to work?
Sorry Caleb Schwind, this is a known regression in 4.13. It should be fixed if you point to js.arcgis.com/next (see GitHub - Esri/feedback-js-api-next: Try out the next release of the ArcGIS API for JavaScript and sh... ).
EDIT: Looks like there is still one outstanding issue with graphics layer highlight being worked on now.
Hi,
Is this still a known issue for 2D in ESRI Javascript 4.14? I can't get graphics layer graphic to highlight.
Thanks,
Carol
Hi there,
Please take a look at this simple app how to do this at 4.14.
Thank you so much for the example. The problem was that I was using picture symbols. Picture symbols work when highlighting FeatureLayers created client-side but not in graphics layer.
Hi there,
Please take a look at [this test app](https://codepen.io/U_B_U/pen/dyojOLd?editors=1000). I cleaned up the code (which I should done in the first app) and graphic now has pictureMarkerSymbol. GraphicsLayerView.highlight is highlighting the graphic with picture marker symbol.
But I am glad to hear that you are using client-side FeatureLayer. It is better to use client-side layer over GraphicsLayer anyway.
Cheers,
-Undral