In the app I am working on, I allow users to select features from a feature layer, which I add using MODE_SELECTION. I have it set to zoom to the extent of the selected graphics, upon the end the user drawn polygon. The issue I am having is odd. When you do the selection for the first time in the session, the features are selected, but the extent doesn't change. If I perform another selection, it zooms to what the previous selection extent was. If I do another selection, again it zooms to the previous selection's extent and so on.
If I add the layer using MODE_ONDEMAND, it works perfectly. Anyone know what I am missing? Attached is the querytask code.
Solved! Go to Solution.
I bet this is a deferred event issue. Try moving your map.setExtent() function inside of the feature selection callback function right above it.
I bet this is a deferred event issue. Try moving your map.setExtent() function inside of the feature selection callback function right above it.
Sarah,
That was it! Thanks for the help!
Ryan
Glad to hear it! It's good practice in the forums to mark a reply as the 'Correct Answer' when it solved your issue, so other folks can find solutions more easily. Have a good one!