Data Model Flex


    xmlns:s="library://ns.adobe.com/flex/spark">
    
    
            
                
                
                
                
            

    
    
    
        
            import mx.collections.Sort;
            import mx.utils.ObjectUtil;
            
            private function handleSort():void
            {
                var sort:Sort = new Sort();
                sort.compareFunction = sortFunction;
                collection.sort = sort;
                collection.refresh();
            }
            
            private function sortFunction( a:Object, b:Object, fields:Array = null ):Boolean
            {
                var dateA:Date = new Date( Date.parse( a.dob ) );
                var dateB:Date = new Date( Date.parse( b.dob ) );
                return ObjectUtil.dateCompare( dateA, dateB );
            }