default sort by date in mm/dd/yyyy format
default sort by date in mm/dd/yyyy format
Hi,
I have a table with dates in it in the mm/dd/yyyy format in the 7th column. I used the
https://datatables.net/plug-ins/sorting/date-dd-MMM-yyyy
plugin to sort the table by date when rendered the first time in the webpage (latest entries first). However, it still sorts them as if they are string. Here is the code
{ "type": "mm/dd/yyyy", "targets": 7 }],
"order": [[ 7, "desc" ]],
I loaded this library //cdn.datatables.net/plug-ins/1.10.19/sorting/date-dd-MMM-yyyy.js
What am I doing wrong? How can I sort the table by date with the latest entries first?
Thanks!
Answers
You are using a deprecated plug-in.
You need this one:
https://datatables.net/blog/2014-12-18
Thanks!
I can't get that to work either. I loaded the two libraries
//cdnjs.cloudflare.com/ajax/libs/moment.js/2.8.4/moment.min.js
//cdn.datatables.net/plug-ins/1.10.19/sorting/datetime-moment.js
with the following code during initialization:
What is wrong with the above code?