all groups > macromedia flash flash remoting > september 2004 >
You're in the

macromedia flash flash remoting

group:

Sorting Datagrid Dates


Sorting Datagrid Dates TonyPimm
9/30/2004 1:26:59 PM
macromedia flash flash remoting: I have a datagrid with about 6 columns, two of which are a From column and a
To column.
Both of these are dates.

I'm using Flash Remoting to a CF back-end, which returns these values as both
a date object, and as a formatted string like "dd mmm yyyy".

I'm currently displaying the formatted string in the datagrid, but when
sorting the values, it does this as a text compare, so it sorts like this:
-01 April 2005
-01 Jan 2004
-01 March 2006

Can anyone suggest a method of being able to sort this field in date order
rather than in text order?

Either by using the date object and applying a date format, or by using some
sorting function to specify the sort order.

Thanks.
Tony
Re: Sorting Datagrid Dates bluestix
10/15/2004 3:28:14 PM
The only way I have found around this is:
1. Convert the dates to a string (yyyy/mm/dd) on the coldfusion page that
returns the recordset.

example:
<cfloop query="Transactions">

<cfif IsDate(#Transactions.Date#)>
<cfset TheYear = Year(#Transactions.Date#)>
<cfset TheMonth = Month(#Transactions.Date#)>
<cfset TheDay = Day(#Transactions.Date#)>
<cfset TheDate = "#TheYear#/#TheMonth#/#TheDay#">
<cfset Transactions.Date = #TheDate#>
</cfif>

</cfloop>

Then if you have to pass updated info back to the database just do the
opposite. ColdFusion will recognize that format in the isDate() Function.

Sorry I havent thought of anything better.

Hahaha

AddThis Social Bookmark Button