code_junkie

Flex - ActionScript: how do I use SortField to sort my data numericly

Nov 13th, 2011
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. public function SortField(name:String = null, caseInsensitive:Boolean = false, descending:Boolean = false, numeric:Object = null)
  2.  
  3. private function createXMLDataProvider():XMLListCollection{
  4. var sort:Sort = new Sort();
  5. sort.fields = [new SortField("@sortorder",true,false,true), new SortField("@label")];
  6. var searchTypesCollection:XMLListCollection = new XMLListCollection(getAssociations(_appData.searchTypes, "category", searchType));
  7. searchTypesCollection.sort = sort;
  8. searchTypesCollection.refresh();
  9. return searchTypesCollection;
  10. }
  11.  
  12. sort.fields = [new SortField("@sortorder",true,false,true), new SortField("@label")];
  13.  
  14. var sortField:SortField = new SortField(value);
  15. sortField.numeric = true;
  16. sortField.descending = true;
  17.  
  18. var sort:Sort = new Sort();
  19. sort.fields = [sortField];
  20. xmlListColl.sort = sort;
  21. return xmlListColl.refresh();
  22.  
  23. sort.fields = [new SortField("@sortorder",false,false,true), new SortField("@label")];
Add Comment
Please, Sign In to add comment