Soft columns by date
Soft columns by date
![btgomez](https://secure.gravatar.com/avatar/153e451023e5103537685ff4967c0ce5/?default=https%3A%2F%2Fvanillicon.com%2F153e451023e5103537685ff4967c0ce5_200.png&rating=g&size=120)
Hi, got problem when sorting columns. It seems that the column are not sorting accordingly. I followed the documentation here: https://datatables.net/plug-ins/sorting/
Below is my code:
Btw, I'm using dd/MM/yy
var dtallJob = $('#allJob').DataTable({
"aLengthMenu": [[20, -1], [20, "All"]],
iDisplayLength: 20,
sScrollY: "50vh",
bScrollInfinite: true, //this property disables pagination
"scrollCollapse": true,
"pagingType": "simple_numbers",
"lengthChange": false,
"bInfo": false,
"dom": 'lrtip',
columnDefs: [
{ type: 'date-eu', targets: 1 },
{ type: 'date-eu', targets: 2 },
{ type: 'date-eu', targets: 3 },
{ type: 'date-eu', targets: 4 }
]
});
This question has accepted answers - jump to:
This discussion has been closed.
Answers
Hi @btgomez ,
That date-eu plugin now is deprecated, see a comment in that post - it says to use datetime now.
Those links should help. If not, we're happy to take a look, but as per the forum rules, if you could link to a running test case showing the issue we can offer some help. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
Hello @colin, here's the live example for the sort date problem:
http://live.datatables.net/coqapici/1/edit
Our date format is: dd/MM/yyyy
As you can see in the first column or in other date column, it doesn't sort correctly.
Regards,
Hi @btgomez ,
You can use the datetime-moment to change the global default for dates - see this thread. This also deals with blank cells.
The datetime plugin that I mentioned before, would also work, provided all the dates are valid, see here.
Cheers,
Colin
Thanks @colin. Is there any option for the blank cells should always be in the last?
Hi @btgomez ,
Yep, you can use the absolute plugin for that, see here.
Cheers,
Colin
Again, thanks @colin, the absolute solved my issue on the NULL. However, on the datetime-moment got an error. I already posted it to the github here's the reference FYI.
I used like this:
Uncaught ReferenceError: moment is not defined
I didn't yet put the code on my source code based from the example: https://datatables.net/plug-ins/sorting/datetime-moment
Okay, I think I'm missing this: