archenil

FeatureLayer SELECTION_ADD and SELECTION_SUBTRACT Example

Discussion created by archenil on Dec 22, 2011
Latest reply on Jun 28, 2013 by swapp0
Hi,

Can someone provide/explain a snippet that performs featurelayer adding and subtracting functionality based on user's selection? For some reason, previously-selected features will not be retained.

      
function addToMap(geometry) {
        selectionToolbar.deactivate();
        map.showZoomSlider();
  
 var selectQuery = new esri.tasks.Query();
 selectQuery.geometry = geometry;
  
 // selectMethod is a variable that holds selectionMethod constant
 featureLayer.selectFeatures(selectQuery, selectMethod);
 map.addLayer(featureLayer);
}
  

In this posting, http://forums.arcgis.com/threads/44845-How-to-add-features-using-SELECTION_ADD, Kelly did mention about using getSelectedFeatures() but I'm still not sure how everything works together.

Any help greatly appreciated!!

Outcomes