I am having an issue where clicking on a graphic in a feature layer more than once will remove the graphic. I have created a plunk that demonstrates this issue. Note that the issue only occurs when using the arcgisUtils.createMap function, not when using the Map constructor.
Is there anything I can do to prevent the graphics from being removed, is this a bug that I need to wait for Esri to fix?
Solved! Go to Solution.
Instead of using the GraphicsLayer add method to add the graphic to the layer try using the feature layer applyEdits method. For example:
fLayer.applyEdits([graphic]);
Instead of using the GraphicsLayer add method to add the graphic to the layer try using the feature layer applyEdits method. For example:
fLayer.applyEdits([graphic]);
Thanks Kelly Hutchins, that fixed the issue I was having.
Is the "bug" I was experiencing actually a bug, though? I didn't see anything in the documentation telling me not to use the add function, and add works when creating the map via the Map constructor. I still don't understand why the graphic was disappearing.
Jeff Jacobson this one could be a documentation bug or a bug with the api. Can you submit this as a support incident so we can track this issue and determine how to resolve the bug.
Looks like this a a documentation bug. Using add with FeatureLayer isn't supported. We'll get the documentation updated to state this.
Kelly