RecordSet.sort(compareFunction)
Method. Sorts all the records using a user-specified compare function. The sort method sorts all the records in place, without making a new copy. The order is determined by the user-supplied compareFunction function. The original order is not remembered.
The sort method is approximately 10 times slower than the sortItemsBy method.
All registered views receive the following callback:
View.modelChanged("sort");
When you use the sort method, avoid sorting a RecordSet object that is associated with an application server and not fully populated yet.
The following example demonstrates how to sort an employeeList RecordSet object by multiple keys:
function orderBySeveralKeys(aRecord, bRecord)
{
var aKey = aRecord.location + aRecord.department + aRecord.lastName;
var bKey = bRecord.location + bRecord.department + bRecord.lastName;
if (aKey < bKey)
{
return -1;
}
else if (aKey > bKey)
{
return 1;
}
else
{
return 0;
}
}
employeeList.sort(orderBySeveralKeys);
RecordSet.addView, RecordSet.filter, RecordSet.sortItemsBy
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flashremoting/mx/Using_Flash_Remoting_MX/asDict43.htm