Date sort with sType html not completely working.

Date sort with sType html not completely working.

dougdoug Posts: 1Questions: 0Answers: 0
edited August 2009 in General
Have a dates in a cells with a non-breaking space at the end of the value. When sorting the date, it sorts for the month and day but not the year. The dates are formatted mm/dd/yyyy. If the non-breaking space is removed, the sorting works.

Aside from removing the non-breaking space are there other alternatives to get this to work correctly?

[code]
$('#Orders_table').dataTable({
"sDom": '<"top"lfrt"bottom"ip>',
"bAutoWidth": false,
// "bStateSave": true,
"sPaginationType": "full_numbers",
"oLanguage": {
"sSearch": "Filter:"},
"aoColumns": [
null,
{ "sType": "html" },
null,
null
]
});

11/21/2009 
[/code]

PS I am loving DataTables.

Replies

  • allanallan Posts: 61,775Questions: 1Answers: 10,112 Site admin
    Hi doug,

    Yes indeed you can get this to work with the space included - what you need to do is put in a custom date sorting function (and auto-detection if you want it as well) - http://datatables.net/development/sorting . The best thing to do would perhaps be to just copy the ones used by DataTables internally and add a 'trim()' to the function inputs.

    The reason I've not done this in the main distribution is mainly just an optimisation to speed things up where possible.

    Regards,
    Allan
This discussion has been closed.