Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > Adobe Web Programming > Flash (all versions)
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Flash (all versions) section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old June 16th, 2006, 05:52 PM
Authorized User
 
Join Date: Apr 2006
Location: bikaner, raj, India.
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to chayanvinayak
Default datagrid does SORT integer data properly

when i get the data through amfphp in Array from , datagrig does not soft data properly.

it sort like ( string data )
10
12
5
6
66

pls suggest solution..........


chayan vinayak goswami
__________________
chayan vinayak goswami
Reply With Quote
  #2 (permalink)  
Old June 26th, 2006, 02:43 PM
Friend of Wrox
 
Join Date: Aug 2004
Location: Orange County, CA, USA.
Posts: 385
Thanks: 0
Thanked 0 Times in 0 Posts
Default

you have to pad the data, it does a character sort. For example:

' 5'
' 6'
'10'
'12'
'66'

notice the space added in front of the 5, 6. convert your data into character data and pad it with spaces and the problem will go away.


Reply With Quote
  #3 (permalink)  
Old July 25th, 2006, 08:43 PM
Friend of Wrox
 
Join Date: Jan 2006
Location: San Francisco, CA, USA.
Posts: 198
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Chayan,

You can define your own sorting function on each column with the DataGridColumn.sortCompareFunction property. Set it to a function with the following signature:

mySortCompareFunction(obj1:Object, obj2:Object):int

The function should return a value based on the comparison of the objects:

* -1 if obj1 should appear before obj2 in ascending order.
* 0 if obj1 = obj2.
* 1 if obj1 should appear after obj2 in ascending order.

Jon Emerson
http://www.jonemerson.net/
Reply With Quote
  #4 (permalink)  
Old July 27th, 2006, 03:59 PM
Friend of Wrox
 
Join Date: Aug 2004
Location: Orange County, CA, USA.
Posts: 385
Thanks: 0
Thanked 0 Times in 0 Posts
Default

but the data grid still sorts in order not numerically if its numerical data but by character.
Thus here is your sorts unless you pad with zeros or spaces or some character data:

35
5
600
7

if you character pad it or zero pad it here is what you can get.

005
007
035
600

or

  5
  7
 35
600


Reply With Quote
Reply


Thread Tools
Display Modes

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
DataGrid Sort ChrisP VB.NET 2002/2003 Basics 0 January 15th, 2006 12:47 PM
integer data type in infopath vikram_vikram Other Programming Languages 0 November 29th, 2005 02:54 AM
Sort Datagrid Sheikha ASP.NET 1.x and 2.0 Application Design 1 June 29th, 2005 05:46 AM



All times are GMT -4. The time now is 04:47 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.