Select to view content in your preferred language

Extracting attributes from FeatureLayer after selectFeatures()

1979
0
07-19-2010 01:51 PM
ReneRubalcava
Frequent Contributor II
I'm having a little difficulty trying to make this work in a simple manner using a FeatureLayer.
I'm able to use fLayer.selectFeatures() to make a selection, and features are highlighted on my map.
problem I'm having now is trying to easily extract the attribute data.
fLayer.selectedFeatures has all the graphics.
I tried fLayer.featureCollection.featureSet.attributes, but featureCollection is null when using selectedFeatures. I'm guessing this would get populated when using fLayer.queryFeaturs() maybe? But then my selection doesn't show up.

This is what I'm trying to do.

fLayer.mode=FeatureLayer.MODE_SELECTION;
fLayer.selectionColor=0x7FFF00;
fLayer.outFields = [ "AssetID", "FeatureID", "Name" ];
fLayer.useAMF=true;
flayer.selectFeatures(query, "new", new AsyncResponder(onFeatureLayerResults_handler, onFault, true)));

function onFeatureLayerResults_handler(features:Array, token:Object = null):void {
    // In some way set the dataprovider for a List/Datagrid to the attributes of fLayer
    // I can iterate the graphics and grab their attributes, but was wondering if there
    // was an easier method 
}


I haven't had much opportunity to use FeatureLayer up to now as I just got all Desktop/Server running ArcGIS 10, so maybe I'm approaching this the wrong way.
Tags (2)
0 Kudos
0 Replies