In the example Using the attribute inspector | ArcGIS API for JavaScript in this section:
map.on("click", function(evt) {
selectQuery.geometry = evt.mapPoint;
petroFieldsFL.selectFeatures(selectQuery, FeatureLayer.SELECTION_NEW, function(features) {
if (features.length > 0) {
//store the current feature
updateFeature = features[0];
map.infoWindow.setTitle(features[0].getLayer().name);
map.infoWindow.show(evt.screenPoint, map.getInfoWindowAnchor(evt.screenPoint));
}
else {
map.infoWindow.hide();
}
});
});updateFeature is always the first feature found in the array. The rest of the code uses updateFeature in several ways. There is also an even listener for next, but how would you ever get to 'next' if you only ever have one feature you're dealing with in the first place?
In my project I may have points that are close to each other and I want to be able to step through all the selected features, not just the first one encountered. I'm not sure how to modify this example to deal with all selected features.