What is the correct date format for a Date column in YUI DataTable ?
- by giulio
I have produced a data table. All the columns are sortable. It has a date in one column which I formatted dd/mm/yyyy hh:mm:ss . This is different from the default format as defined in the doco, but I should be able to define my own format for non-american formats. (See below)
The DataTable class provides a set of
built-in static functions to format
certain well-known types of data. In
your Column definition, if you set a
Column's formatter to
YAHOO.widget.DataTable.formatDate,
that function will render data of type
Date with the default syntax of
"MM/DD/YYYY". If you would like to
bypass a built-in formatter in favor
of your own, you can point a Column's
formatter to a custom function that
you define.
The table is generated from HTML Markup, so the data is held within "" tags.
This gives me some more clues about compatible string dates for javascript:
In general, the RecordSet 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. Converting data types
as data comes into your RecordSet is
enabled through the parser property in
the fields array of your DataSource's
responseSchema
I suspect that the I'm missing something in the date format. So what is an acceptable string date for javascript, that Yui dataTable will recognise, given that I want format it as "dd/mm/yyyy hh:mm:ss" ?