views:

21

answers:

1

Hi,

I won't be able to sort the column which has the date format(mm/dd/yyyy HHMMSS) by using YUI YAHOO.widget.DataTable.formatDate

Please help me out on this problem

Regards

A: 

Well, from YUI dataTable

It expects to hold data in native JavaScript types. For instance, a date is expected to be a JavaScript Date instance, not a string like "4/26/2005" in order to sort properly. Therefore, the type of the data (e.g., String, Number, Date, etc.) held in the dataTable determines the sort algorithm, not the type as defined in your Column definition formatter property.

Which implies the formatter property (used to show data in a human-friendly format) function has nothing to do with the sorting algorithm

How does input data is converted ???

Converting data types as data comes into your dataTable is enabled through the parser property in the fields array of your DataSource's responseSchema

You question is not clear. I suppose your data comes as mm/dd/yyyy HHMMSS. If so, you need to convert to a plain JavaScript Date (as said above) by using dataSource's parser property

myDataSource.responseSchema = {
    fields: [
        {key:"birthDate", parser:function(data) {
            // Convert to native JavaScript objects right here        
        }}
    ]
}
Arthur Ronald F D Garcia