I'm trying to load a few elements of an RSS feed into a DataGrid, and I'm
having trouble with the code to pre-sort the data before the grid gets it.
Here's a snippet of the code:
private function requestRSS(e:FlexEvent):void
{
initVars();
showBusyCursor();
rssService.url = rssUrl;
rssService.resultFormat = "e4x";
rssService.useProxy = false;
rssService.addEventListener(ResultEvent.RESULT,
resultHandler);
rssService.addEventListener(FaultEvent.FAULT,
faultHandler);
rssService.send();
}
private function resultHandler(e:ResultEvent):void
{
listHeadlines.dataProvider =
e.target.lastResult.channel.item;
}
In the mxml:
<mx:DataGrid id="listHeadlines" width="433" height="113"
click="showDetails(event)">
<mx:columns>
<mx:DataGridColumn dataField="pubDate" sortDescending="true"/>
<mx:DataGridColumn dataField="title"/>
</mx:columns>
</mx:DataGrid>
At this point my data in e.target.lastResult.channel.item is not always sorted
properly. I'd like to sort it by pubDate descending before filling out the
DataGrid. Any guidance on this?