Everyone:

I have used sortCompareFunction attribute of gridcolumn to resolve date sort 
issue in my application. 

Below is the part of my code

.....
<mx:DataGridColumn headerText="Date" columnName="joinDate" width="100" 
sortCompareFunction="sortGrid" labelFunction="formatDate" />

.....

function sortGrid(a, b, index) {
        if (a == b)
                return 0;
        else if (a < b)
                return -1;
        else
                return 1; 
}
function formatDate(rowData):String     {
        var dFormat = new mx.formatters.DateFormatter();
        return (dFormat.format(rowData.feedbackCreationDate));
}
....


1. But now I'm facing a performance issue. My application is populating 1000 
records in the grid and when I click on the header to sort grid on date order 
then it hangs the application and throw script error "A script in this movie is 
causing Macromedia Flash Player 8 to run slowly. If continues to run, your 
computer may become unresponsive. Do you want to abort the script?" 

Same script works fine if I populate with less number of records, say 100, in 
grid but then this takes more then 10 secs to sort data. Do we have any 
solution to this issue? 

Also, if I remove labelFunction then script works fine for 1000 records but 
takes long time to order all data.

2. Is it possible to remove ordering from the grid and show default order list? 
Click one will sort data in ascending order, Click two will sort data in 
descending order and Click three will show the default order or remove ordering 
from the grid.


Regards,
Nischal Pathania 
________________________________________
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Matt 
Chotin
Sent: Tuesday, October 11, 2005 20:53
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] date sort

sortCompareFunction is meant for you controlling the sort regardless of whether 
you had a cell renderer.  You just need the DataGridColumn.  In your case since 
the data is already formatted using the labelFunction you may want the 
sortCompareFunction to work on the unformatted value.

________________________________________
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL 
PROTECTED]
Sent: Friday, October 07, 2005 2:17 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] date sort


Ya I have tried that but from I understand that only work when the date is from 
cell renderer. Mine is coming from a java object and is using label to format 
it. 




CONFIDENTIALITY STATEMENT - This message and any files or text attached to it 
are intended only for the recipients named above, and contain information that 
may be confidential or privileged.  If you are not an intended recipient, you 
must not read, copy, use, or disclose this communication.  Please also notify 
the sender by replying to this message, and then delete all copies of it from 
your system.  Thank you. 
"Matt Chotin" <[EMAIL PROTECTED]> 
Sent by: flexcoders@yahoogroups.com 
10/05/2005 05:27 PM 
Please respond to
flexcoders@yahoogroups.com

To
<flexcoders@yahoogroups.com> 
cc

Subject
RE: [flexcoders] date sort







If it's not working by default you may want to look into the 
sortCompareFunction on DataGridColumn. 
  
Matt 
  

________________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Joe
Sent: Wednesday, October 05, 2005 2:33 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] date sort 
  
Is there a way to sort a date field in a data grid that is using a 
labelfunction to get the date value. I have read that it can be done 
when using a cell renderer, but I do not want to change the code. Can 
this be done? Thanks.





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 

SPONSORED LINKS 
Web site design development 
Computer software development 
Software design and development 
Macromedia flex 
Software development best practice 



________________________________________
YAHOO! GROUPS LINKS 

*  Visit your group "flexcoders" on the web.
  
*  To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
  
*  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 

________________________________________




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 


SPONSORED LINKS 
Web site design development 
Computer software development 
Software design and development 
Macromedia flex 
Software development best practice 


________________________________________
YAHOO! GROUPS LINKS 

*  Visit your group "flexcoders" on the web.
  
*  To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
  
*  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 

________________________________________


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
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/
 




Reply via email to