DataTables upgrade to 1.10.15: simple mm/dd/yyyy date sort is not working

DataTables upgrade to 1.10.15: simple mm/dd/yyyy date sort is not working

GunjanGunjan Posts: 4Questions: 1Answers: 0
edited August 2017 in Free community support

I've taken the simple intialization example and created a jsFiddle with the problem we are seeing. Can you please point out what's wrong here?
https://jsfiddle.net/gv4noyrk/3/
The StartDate is not getting detected as Date, it gets sorted alphabetically.
A few additional points - It's broken in both Chrome & IE.
irrespective of the sort order 9/12/2016 should always be between 1/1/2016 and 1/1/2017.
Any help or ideas will be much appreciated.
Here is the same code with 1.10.12 version and it works once you sort the date column.
https://jsfiddle.net/mvfwtbfb/

Answers

  • bindridbindrid Posts: 730Questions: 0Answers: 119

    try $('#example').DataTable({columnDefs:[{targets:[4], type:"date"}]});

  • GunjanGunjan Posts: 4Questions: 1Answers: 0

    Thank you for your reply. So specifying for each table is the only option. There is nothing sitewide. Looks like you would have to use moment and the plugin to make this work. Thanks for the reply.

  • allanallan Posts: 63,471Questions: 1Answers: 10,467 Site admin

    See this thread which I've answered @Gunjan's question on the same topic.

    Ideally you should never really need to set the columns.type option. It should be done by automatic type detection (unless you are using a sorting plug-in which doesn't have automatic type detection!).

    Allan

This discussion has been closed.