:: Forum >> Version 2 >>

Sorting Date columns in Beta3/4 using DD/MM/YYYY format

I'm trying to sort data in a grid with a date column. The data in this column is in the format dd/mm/yyyy.

In Alex's post <a href="http://www.activewidgets.com/javascript.forum.10412.0/using-data-formats-with-js.html target="_new">/javascript.forum.10412.0/using-data-formats-with-js.html</a>, the example used dates in the format mm/dd/yyyy. I changed the example to use dates in dd/mm/yyyy format and the dates no longer sort correctly.

- Is there a setting to indicate to the underlying code which date model is being used?
- If the user enters dates in the local format, would it be best to capture these and convert them to the underlying mm/dd/yyyy format?

Thanks, Helen.

PS. Sorry if this has been asked previously!

var ukFormat = [ 
    [
"aaa""111""21-02-2005"], 
    [
"bbb""22""01-01-2004"], 
    [
"bbb""22""10-11-2002"] ,
    [
"bbb""22""31-01-2003"],
    [
"bbb""22""31-01-2004"]
]; 

var 
usFormat = [ 
    [
"aaa""111""02-21-2005"], 
    [
"bbb""22""01-01-2004"], 
    [
"bbb""22""11-10-2002"] ,
    [
"bbb""22""01-31-2003"],
    [
"bbb""22""01-31-2004"]
]; 

var 
string = new AW.Formats.String
var 
number = new AW.Formats.Number
var 
date = new AW.Formats.Date;

var 
obj = new AW.UI.Grid
obj.setCellText(ukFormat); 
obj.setCellFormat([stringnumberdate]); 

obj.setColumnCount(3); 
obj.setRowCount(5); 

document.write(obj); 
Helen Williamson
Friday, January 27, 2006



This topic is archived.

Back to support forum

Forum search