Hi Guys I am trying to sort the dataProvider in the list which is in the form of XMLListCollection, I am using amfPHP for grabbing data in the form of XMLListCollection and for the display purpose I am using labelfunction to display just the friendly name of my entries which is the specific attribute from the XMLListCollection. I went through few tutorials online for sorting and came up with the following code but some how this is not working, Can any one please help me in figruing out whats going on here and why sorting of the list is not working, Thanks
/**********************CODE*************************/ <mx:RemoteObject id="amfSetup" source="Setup" destination="amfphp"> <mx:method name="getList" result="getListHandler(event);" fault="getListFault(event);"/> </mx:RemoteObject> [Bindable] private var entriesXmlListFull:XMLList; [Bindable] private var entriesXmlCollection:XMLListCollection; public function getListHandler(event:ResultEvent):void { entriesXmlListFull = XML(event.result).device; populateEntries(); } private function getListFault(event:FaultEvent):void { Alert.Show("Error retreiving Data"); } //Displaying names need to be displayed in the List box private function entriesLabelFunc(item:Object):String { var xmlItem:XML = item as XML; return xmlItem..attribute.(@name=="friendlyname"); } //Populating List with XML Objects private function populateEntries():void { entriesXmlCollection = new XMLListCollection(); for each(var item:XML in entriesXmlListFull) { var friendlyName:String = item..attribute.(@name=="friendlyname"); //Only add camera type if ( !recordValue && hasFriendlyName && (itemType.toUpperCase() == "CAMERA") ) { entriesXmlCollection.addItem(item); } } //Calling Sort on XMLList collection entriesXmlCollection.sort = sortList; entriesXmlCollection.refresh(); } <mx:Sort id="sortList"> <mx:fields> <mx:SortField name="*" caseInsensitive="true" /> </mx:fields> </mx:Sort> <mx:List id="listData" dataProvider="{entriesXmlCollection}" labelFunction="entriesLabelFunc"/>