Looks like the only workarounds to this problem (that I've seen) have to do with tricking the datagrid header to sort numbers correctly (numerically)..
I'm doing things a little differently.. I have two custom buttons that I would like to handle my sorting. ( I have the datagrid header hidden for various reasons)
My first column is a list of "application names" which i would like to remain happyly sorting as strings.
My second column is a list of "total cost" that I would like to sort
numerically.
I would like to use Array.NUMERIC but I only want to affect the "total cost" column.
So here is the question:
How can I convert the "total cost" column of the datagrid to a float, and get it to sort numerically within the datagrid?
Here is the relevent code:
ActionScript Code:
var arrApps:Array = convertNodeListToObjectArray(nlAppData);
oDataGrid.dataProvider = arrApps;
btnSortByApplication.onRelease = function(){ this._parent.SortByApplication() };
btnSortByTotal.onRelease = function(){ this._parent.SortByTotal() };
private function gridInit(){
// Add Application Name Column to Bottom Grid
newColumn = new DataGridColumn("n");
newColumn.editable = false;
newColumn.resizable = false;
newColumn.sortable = false;
newColumn.sortOnHeaderRelease = false;
newColumn.width = 100;
newColumn.fontWeight="bold";
newColumn.textDecoration = "underline";
newColumn.color = 0x0033CC;
oDataGrid.addColumn(newColumn);
//Add Total Column
newColumn = new DataGridColumn("t");
newColumn.editable = false;
newColumn.resizable = false;
newColumn.sortable = false;
newColumn.sortOnHeaderRelease = false;
newColumn.textAlign = "right";
newColumn.width = 80;
oDataGrid.addColumn(newColumn);
oDataGrid.editable = false;
}
//column "n" is the application names column
private function SortByApplication(){
oDataGrid.sortItemsBy("n", "ASC");
}
//column "t" is the total cost column that I would like to sort numerically
private function SortByTotal(){
oDataGrid.sortItemsBy("t", "DESC");
}
*note that right now.. it sorts, just not correctly on the total cost column.. everything else is working
Thanks!