Well you can try an eventListener for the sortChanging[1] event of the 
datagrid.   You can reference the column clicked by checking the last item 
added [2].  Once you're done with your own means of sorting the ArrayCollection 
or adding your own spark Sort with SortField [3] you can prevent the default 
sort[4].  Below are incomplete, but should give enough to get the gist.


[1] 
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/DataGrid.html#event:sortChanging


[2]
var column:GridColumn;
var columnIndex:int = -1;

columnIndex = event.columnIndices[event.columnIndices.length - 1];

column = event.currentTarget.columns.getItemAt(columnIndex);


[3] 
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/collections/Sort.html
 
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/collections/SortField.html

var sort:Sort =new Sort();

sort.fields = new Array();
sort.fields.push(new SortField("FieldName", isDescending, isNumeric));

myArrayCollection.sort = sort;


[4] event.preventDefault();


-Mark

-----Original Message-----
From: bilbosax [mailto:waspenc...@comcast.net]
Sent: Monday, July 25, 2016 3:03 AM
To: users@flex.apache.org
Subject: Re: Why are Spark Datagrid headers sorting my data so slowly in Air?

I wish I could, but I would not be able to get permission to send you the
company database.  I did figure out that if I did the sorts by writing my
own routines on the arraycollection, the datagrid updates in about a second.
This is a *enormous* improvement, but leaves me with the task of writing 52
sorting subroutines.  Oh well, it is better than nothing.  At this point, I
can only surmise that the problem is within the sorting routines contained
within the spark datagrid component. That is my 2 cents.



--
View this message in context: 
http://apache-flex-users.2333346.n4.nabble.com/Why-are-Spark-Datagrid-headers-sorting-my-data-so-slowly-in-Air-tp13026p13053.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Reply via email to