Setting sType to 'date' and enabling sorting

Setting sType to 'date' and enabling sorting

pbrstreetgangpbrstreetgang Posts: 6Questions: 0Answers: 0
edited June 2011 in General
I love this plugin, but I am having what i believe are some simple issues I am having trouble debugging.
I am trying to set up a table to sort on date correctly. I have not been able to get it working after reviewing documentation and the forums. I am hoping someone here can lend a hand.
My dates are in mm/dd/yyyy format. Columns 3 and 4 are dates. What I want is for column 3 to be sorted by default by date, desc. And i want to be able to click on the header of either column 3 or 4 to sort (clicking the same column head more then once would toggle between desc and asc sorting based on date value).

My code to initialize the table is:

[code]
$(document).ready(function() {
$('#table_DataTable').dataTable({
"sPaginationType": "full_numbers",
"bAutoWidth": false,
"sDom": '<"top"iplf>rt<"clear">',
"bRetrieve": true,
"aoColumnDefs":[ { "sType": 'date', "aTargets": [ 3, 4 ] }, { "asSorting": [ "desc", "asc", "asc" ], "aTargets": [ 3, 4 ] }, { "bSortable": true, "aTargets": [ 3, 4 ] }],
"aoColumns": [ {"sWidth": "20px"}, {"sWidth": "20px"}, {"sWidth": "60%"}, {"sWidth": "100px"}, {"sWidth": "100px"}, {"sWidth": "50px"} ]
});
});
[/code]

The result i get is the columns are seemingly sorted. However, I cannot click on column headers to reverse the sort order. And I do not get any JS errors from FireFox.
Any help anyone can provide - or point me in the right direction - is greatly appreciated.
Thanks,

pbr

Replies

  • pbrstreetgangpbrstreetgang Posts: 6Questions: 0Answers: 0
    Solution/Work-around: I rewrote the sorting of the date to be yyyy-MM-dd to sidestep this issue.
This discussion has been closed.