The following code is an example:-
Sorting on Date Column on Datagrid use the following code
Sorting is done by calling sortComapareFunction in Datagrid Column. Please follow method below for date sorting.
public static function dateSortCompare(date1:Object, date2:Object):int
{
var dateA:Date=DateFormatter.parseDateString(date1.errorDateTime);
var dateB:Date=DateFormatter.parseDateString(date2.errorDateTime);
//trace("date1.errorDateTime="+date1.errorDateTime+", date2.errorDateTime="+date2.errorDateTime+", "+ObjectUtil.dateCompare(dateA, dateB));
return ObjectUtil.dateCompare(dateA, dateB);
}
No comments:
Post a Comment