Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 03-28-2005, 08:08 PM   #1
Arbitrager
Registered User
 
Join Date: Mar 2005
Posts: 10
Question datagrid numeric sort issues

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!
Arbitrager is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:22 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.