FeatureLayers & Events issues

201
1
09-15-2011 10:33 AM
earthmineinc
New Contributor
Hi,

After adding a new feature to a featureLayer via "myFeatureLayer.applyEdits([ graphic ], null,  null);" I catch the FeatureLayerEvent.EDITS_COMPLETE well, so I assume that I can query my new set of features from the server, what I try to do just after with "myFeatureLayer.queryFeatures", but in fact it seems that it takes some time for the server to "register" the new feature I've just added and I dont get it in the result of my query, even though I can display it on my layer. So, it seems that either the FeatureLayerEvent.EDITS_COMPLETE is dispatch to early or maybe I am not listening to the right event, thank you for feedback.

Other thing, so, after adding my new feature and catching the FeatureLayerEvent.EDITS_COMPLETE, I want to display it on the map (or the layer to be precise), and I assume that "myFeatureLayer.refresh()" will help me but in fact it doesn't seem to work. I have to update the location of the center of the map ("_map.centerAt(_map.toMap(new Point(_map.width/2,_map.height/2)));") to force the refresh. Did you notice that? And the "LayerEvent.UPDATE_END" doesn't seem to be dispatched either...

Sorry to bother you with all that stuff, but it would be great to have some insights from you.
Regards,

Alex
Tags (2)
0 Kudos
1 Reply
earthmineinc
New Contributor
Well I figured out the problem : There are problems (at least the ones discribed before) if you display the same featureLayer 2 times but with different names... events are mixed up...
So I just removed one of these and everything works fine now, but I guess there might be something to do to avoid bugs when that kind of situation arises... ;)
Alex
0 Kudos