AnsweredAssumed Answered

removeAllGraphics + addGraphic + dataChanged

Question asked by aconnolly on Sep 24, 2012
Latest reply on Sep 28, 2012 by aconnolly
Hello,

I have a question regarding the dataChanged method on the AGSGraphicsLayer. My application removes all the graphics, then adds graphics one by one from a list, then calls dataChanged on the layer. Is it expected that dataChanged should pick up all the changes made to the layer? By that I mean, should I expect my old graphics to be removed and the new graphics added after the call to dataChanged? Or do I need to call dataChanged after I remove OR add graphics, each time?

The reason I ask is that something weird is going on and the single call to dataChanged doesn't refresh my map. If I change my code to look like this:

removeAllGraphics;
dataChanged;  // <-- Added extra call

addGraphic;
dataChanged;

The map will refresh properly. Odd, right? What's the expected behavior here?

Thanks
- Aaron

Outcomes