Renderer on a Feature Layer Selection Set

501
1
08-19-2013 11:12 AM
RaghuVamshi
New Contributor
On a feature layer, applying an unique value renderer is providing the necessary symbology - based on an attribute field, the renderer is applied to all features in the feature layer. Now, the renderer needs to be applied only to the "selected features" of the feature layer:

featureLayer.selectFeatures(selectQueryTask, esri.layers.FeatureLayer.SELECTION_NEW);


On these selected features (using getSelectedFeatures() or other property), how can I apply the renderer? Any suggestions will be helpful. Thanks in advance!

-Raghu
0 Kudos
1 Reply
RaghuVamshi
New Contributor
For those with a similar question, here is a working solution. I could not get the unique renderer to work on the selection set. Instead, assigned a graphic (and unique color) to each feature. There should be a better way to do this, am open to any suggestions.

-Raghu

function colorSelFeatures(featureset)
{
    for (var i = 0; i < featureset.length; i++)
   {
        //add each feature from featureset to graphic
        var graphic = features;
        graphic.setSymbol(new esri.symbol.SimpleFillSymbol().setColor(getRandomColor())); //calls a function to assign color to each graphic

        map.graphics.add(graphic);
    }

}
0 Kudos