FeatureLayer.SELECTION_ADD - am I doing this wrong?

2970
1
03-13-2012 02:43 PM
ReneRubalcava
Frequent Contributor
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.
Tags (2)
0 Kudos
1 Reply
ReneRubalcava
Frequent Contributor
Nevermind. This works as intended. I was able to track down the issue in my application to a bug in my library that cleared all GraphicsLayers on varying events, including before I ran my FeatureLayer query.

My bad, thanks.
0 Kudos