protected function extractAttributesFromFeatures(features:Array):Array {
var f:Array = [];
var g:Graphic;
for each (g in features) {
f.push(g.attributes);
}
return f;
}
QBData.dataProvider = fset.attributes;
<mx:VBox width="100%" height="95%" minHeight="0" minWidth="0">
<mx:DataGrid id="QBData" width="100%" height="100%" itemClick="itemClick(event);" minColumnWidth="100" resizableColumns="true">
</mx:DataGrid>
</mx:VBox>
<mx:DataGrid id="attributeTable" dataProvider="{data}">
<mx:columns>
<mx:DataGridColumn headerText="Key" dataField="{?}"/>
<mx:DataGridColumn headerText="Value" dataField="{?}"/>
</mx:columns>
</mx:DataGrid>I'm still not 100% clear on FeatureLayers purpose. It would seem looking at examples it's usefulness is really for editing and time-aware data. I'm sure they've covered it in more detail somewhere, but I may have missed it.
So far the method I have been using to extract attributes from a FeatureLayer is manually.
...
Then you can set that result to a Datagrid dataprovider.
AsyncToken(fLayer.selectFeatures(query, "new", new AsyncResponder(response, onFault)));
[Bindable]
featuresColl:ArrayCollection; // bind this to a DataGrid dataprovider
private function response(features:Array, token:Object = null):void {
var f:Array = extractAttributesFromFeatures(features); // for loop in previous post
featuresColl = new ArrayCollection(f);
}
var attributes:Array = new FeatureSet(ArrayCollection(featureLayer.graphicProvider).toArray()).attributes;
var featureSet:FeatureSet = new FeatureSet(ArrayCollection(firePerimeter.graphicProvider).toArray()); fireDataGrid.dataProvider = featureSet.attributes;