3.0.0

sorting UK dates issue v2.5

could some please put together a complete solution for fixing the issue with sorting uk formatted dates. There are alot of threads mentioning sorting issues, however these seem to be for version 1.

I am looking for a solution that will allow sorting of UK dates WITHOUT setting a different setCellData to a setCellText as I do not wish to build up two arrays, one for sorting and one for display.

looking through the forum I have cobbled together the following, it does not work, but it must be close? If anyone knows where I am going wrong it would be much appreciated.

...
// from Rekcor date format topic
function datetime(text){var oData = new AW.Formats.Date; return Number(Date.UTC(text.substr(6, 4),text.substr(3, 2),text.substr(0, 2)))}

//date format is dd/mm/yyyy

obj.setCellFormat([toValue]);

var tovalue = 'str, datetime, str'

obj.setCellData(myData, function(i,j){return toValue[j](obj_data[i][j]);});
...


The page loads and sorts, however the date does not sort correctly. Any ideas? Its fairly urgent, so any feedback much appreciated.

russ
November 25,
sorted,

Main problem was the format of date in the array. I am populating my javascript array using a vb.net dataSet, this will automatically format the date. To get the date sorting to work the date format must be in ISO8601 format, yyyy/mm/dd.... However this would be automaticly converted when populating my dataset into dd/mm/yyyy, which is incorrect. Using code from the documentation,

...
var dte = new AW.Formats.Date;
dte.setDataFormat('ISO8601');
dte.setTextFormat('mm/dd/yyyy');

obj.setCellText(myData);
obj.setCellData(myData);
obj.setHeaderText(myColumns);

//only one column
obj.setCellFormat([dte]);
...


Providing your date is in yyyy/mm/dd then this will work.

I have seen this in so many places, but wasn't working due to the format being passed into myData not being in the correct format.

Thought i would post this incase anyone else was having the same issue.
russ
November 25,

This topic is archived.

See also:


Back to support forum

Search

Version 2

Looking for AW 2.6 ?
The old site is here.