How about sorting on a hidden column?  Format the date YYYYMMDDJJNNSS in this 
hidden column.
 

________________________________

From: flexcoders@yahoogroups.com on behalf of Sean McKibben
Sent: Tue 6/14/2005 3:34 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Design flaw in DataGrid sorting


I have to call the data grid's sorting mechanism flawed.

Let's examine a case where you want to sort a dataGrid by a date  
column. In all likelihood, you're going to have a labelFunction to  
format your date objects into a string. Depending on your locale,  
that string is probably not what you want to sort on (i.e. 02/04/05  
comes before 02/03/06 on the calendar, but not as a string), so you'd  
like to write a sortCompare function for that column.

Unfortunately, the sortCompare function only receives the string  
value from the labelFunction, so you'd either have to do some very  
slow string parsing, or sort based on the results from the  
labelFunction alone. You don't get a chance to compare any more  
information about a row than the string returned by a labelFunction,  
and the labelFunction can only return a string.

Not a good way to do it, Macromedia!

So, what is the best workaround? Let it sort once, then resort using  
the headerRelease event and operating on the DataProvider? (assuming  
headerRelease fires after sorting is done - contrary to the  
documentation, but in line with Ailstair McLeod's tests)


Sean



________________________________

Yahoo! Groups Links


*       To visit your group on the web, go to:
        http://groups.yahoo.com/group/flexcoders/
          
*       To unsubscribe from this group, send an email to:
        [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 
          
*       Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service 
<http://docs.yahoo.com/info/terms/> . 




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

<<winmail.dat>>

Reply via email to