1 Reply Latest reply on Mar 14, 2012 6:15 AM by odoe

    FeatureLayer.SELECTION_ADD - am I doing this wrong?

    odoe
      I recently tried updating an app to allow adding selections to a FeatureLayer. This is using the 2.4 Flex API (want to avoid updating for the moment).
      I'm not doing any editing, I'm just loading the FeatureLayer with a service url like so
      http://internalserver/ArcGIS/rest/services/SewerFeatures/MapServer/4
      I create my FeatureLayer like so
      fLayer.mode = FeatureLayer.MODE_SELECTION
      


      This thread suggests that I should use FeatureLayer.SELECTION_ADD when initializing, but when I did that, no selections worked.

      Anyway, I can do a selection using the default "new"
      fLayer.selectFeatures( query, FeatureLayer.SELECTION_NEW, new AsyncResponder( onSewerFeaturesSelected, onFault ));
      


      Then when I try to add to this selection at some point after the results are shown
      fLayer.selectFeatures( query, FeatureLayer.SELECTION_ADD, new AsyncResponder( onSewerFeaturesSelected, onFault ));
      


      It doesn't add new features to the selection, it just does a new selection and clears what was previously selected.

      These queries are being done via a geometry if that matters.

      Maybe I'm misunderstanding what FeatureLayer.SELECTION_ADD does when in FeatureLayer.MODE_SELECTION.

      I can probably work around it by saving my selected graphics and adding them back, but I would think the above method should work.