Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > Adobe Web Programming > Flash (all versions)
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 16th, 2006, 04:52 PM
Authorized User
 
Join Date: Apr 2006
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
 
Old June 26th, 2006, 01:43 PM
Friend of Wrox
 
Join Date: Aug 2004
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.


 
Old July 25th, 2006, 07:43 PM
Friend of Wrox
 
Join Date: Jan 2006
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/
 
Old July 27th, 2006, 02:59 PM
Friend of Wrox
 
Join Date: Aug 2004
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







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 04:46 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.