tags:

views:

834

answers:

2

Hi, After applying a numeric sort to my dataprovider(Array Collection), I can not reorder the items via a tilelist. Do I need to remove the sort from the arrayCollection. If so, is it just a case of setting collection.sort = null ?

Any help much appreciated.

var sortField:SortField=new SortField();
sortField.name="order";
sortField.numeric=true;
var sort:Sort=new Sort();
sort.fields=[sortField];
+2  A: 

Setting the sort to null should indeed remove the sort for the collection. You might need to do an optional refresh().

Christophe Herreman
A: 

http://kuriakosejacobthomas.blogspot.com/2009/10/adobe-flex-sorting-arraycolleciton-by.html

Adobe Flex - Sorting an ArrayColleciton by Date /** * @params data:Array * @return dataCollection:Array **/ private function orderByPeriod(data:Array):Array { var dataCollection:ArrayCollection = new ArrayCollection(data);//Convert Array to ArrayCollection to perform sort function

var dataSortField:SortField = new SortField(); dataSortField.name = "period"; //Assign the sort field to the field that holds the date string

var numericDataSort:Sort = new Sort(); numericDataSort.fields = [dataSortField]; dataCollection.sort = numericDataSort; dataCollection.refresh(); return dataCollection.toArray(); }

Kuriakose Jacob Thomas