Select to view content in your preferred language

Selected features cleared in FeatureLayer after onResume({firstOccurence: true})

677
1
01-31-2013 11:57 AM
LucasScharenbroich
Occasional Contributor
I am trying to load an initial set of features into a FeatureLayer immediately after the map and FeatureLayer are loaded via the FeatureLayer.selectFeatures(query) call.

The FeatureLayer has a scale range that is outside of the initial map scale.

The selectFeatures call is successful and the selectedFeatures property has the list of features.  However, once the map is zoomed in past the scale range threshold, the FeatureLayer's resume() method is called from evaluateSuspension() method with evt.firstOccurence = true.  I don't quite follow the flow of events after this point, but presumably, calling the initialize() method on the layer._mode object clears out any selected features.

The end result is that selected features are cleared from the FeatureLayer and do not display on the map.

I've worked around the issue by calling the private FeatureLayer._resume() and FeatureLayer._suspend() methods from my onLoad event handler but before I call the initial selectFeatures().  This works, but I'd like to avoid calling internal methods.

Also, calling the non-private resume() and suspend() methods do not work because the Layer.canResume() function always returns false because this.visibleAtMapScale is false.

Any suggestions on how to perform a initial selectFeature() on a FeatureLayer?
0 Kudos
1 Reply
FredSpataro
Occasional Contributor III

Did you ever figure out the appropriate methodology for this situation?  I have two feature layers representing the same entity (point and polygon) as different scales.  I call the selectFeatures method on both to keep the set in sync but whichever layer is out of scale visibility won't stay "selected"... 

0 Kudos