Using Ultimate Date/Time Sort

Using Ultimate Date/Time Sort

akayadayakayaday Posts: 3Questions: 1Answers: 0
edited September 2015 in Free community support

I'm trying to implement the Ultimate Date/Time sort found here: http://www.datatables.net/blog/2014-12-18

However, I cannot get the column to read as a date. The main problem is that it goes from 1/1/2015 to 11/1/2015 and not to 2/1/2015. I think it is just reading the numbers and doing a sort that way. Is this because it is a string and not a date object? My limitation is that my data source only provides the date as a string.

Thanks!
akayaday

Answers

  • ThomDThomD Posts: 334Questions: 11Answers: 43

    Sample code please.

  • akayadayakayaday Posts: 3Questions: 1Answers: 0
    edited September 2015

    $.fn.dataTable.moment('M/D/YYYY');
    //DataTable
    var table = $('#example').DataTable({
    "scrollY": "500px",
    "scrollX": true,
    "scrollCollapse": true,
    "paging": false,
    "order": [[2, "desc"]]
    });

  • ThomDThomD Posts: 334Questions: 11Answers: 43

    Please reformat that code, per the instructions at the bottom of the screen.

  • allanallan Posts: 63,747Questions: 1Answers: 10,509 Site admin

    Hi,

    As far as I can see from the above, what you have looks to be correct. Could you link to a page showing the issue, or use the DataTables debugger so we can take a look and see what is going wrong please?

    My guess is that there is something in the column that is making that column not valid for that date format (HTML tags for example, or a cell which is empty or has something other than that format in it), but it is impossible to say without a test case (which is noted in the forum rules :-) ).

    Thanks,
    Allan

  • akayadayakayaday Posts: 3Questions: 1Answers: 0

    Allan;

    Unfortunately, the nature of the data and the site means I have to use a lot of discretion, but I think that the null objects in the column might have something to do with the issue. I'll check back soon!

    akayaday

This discussion has been closed.