FeatureLayer also supports feature selection. Selected features are a subset of the features in a layer which can be used for viewing, editing, analysis, or as an input to other operations. Features are added to or removed from a selection set using either spatial or attribute criteria. The features in the selection set are often drawn with different symbologies to differentiate them from the other features in the layer.
To create a selection set, use the selectFeatures(query) method on FeatureLayer. A parameter is a Query object exactly like the one you have already seen with QueryTask. This is illustrated by the following code example:
var selectQuery = new Query(); selectQuery.geometry = geometry;
featureLayer.selectFeatures(selectQuery,FeatureLayer.SELECTION_NEW);
We haven't covered the Query object in detail yet, but just like in QueryTask, you...