How can you change Graphic.visible in 4.10

2329
12
02-05-2019 03:34 PM
KrisKaplan1
New Contributor II

Prior to 4.10, Graphic client side features added to a FeatureLayer could be hidden and shown by toggling the Graphic.visible property, but this no longer appears to work in 4.10.  I have tried changing 'visible' and calling FeatureLayer.applyEdits in the 'updateFeatures' value, but this does not appear to modify the property value (nor change the visibility).

I know I can remove and re-add the feature from the layer instead of toggle the visibility, but for a few reasons it would be more convenient to just toggle the visibility.  Is this still possible in 4.10?

Kris

0 Kudos
12 Replies
TylerKirk
New Contributor II

Thanks for the response. I already understand how to utilize applyEdits for client-side FeatureLayer manipulation. My question was about the client-side FeatureLayer graphic's visible property not working and if the API will support it like it once did in the 4.9.

0 Kudos
JohnGrayson
Esri Regular Contributor

At 4.10, I believe direct access to graphics was replaced by the use of applyEdits().  At 4.10, if you would like for your graphic to not display then you can use the 'deleteFeatures' parameter of applyEdits(...).  When direct manipulation (add/delete) of a Graphic is absolutely necessary in an app, I've then switched back to using a GraphicsLayer.

KrisKaplan1
New Contributor II

Thanks for the feedback.  But from the original question:

"I know I can remove and re-add the feature from the layer instead of toggle the visibility, but for a few reasons it would be more convenient to just toggle the visibility."

Likewise, using the GraphicsLayer instead of FeatureLayers for all graphics just for this ability to toggle individual feature visibility would (at least in our case) be a significant change and consequences (loss of other features that require FeatureLayer).

0 Kudos