Ignore empty cells when sorting dates

Ignore empty cells when sorting dates

yakseyyaksey Posts: 9Questions: 4Answers: 0

Hey everybody,

I made my custom date sortable with datetime-moment.js and the following line:
$.fn.dataTable.moment( 'DD.MM.YY' );

And it works pretty fine so far. But my problem is, that it doesn't ignore empty cells.
So if I sort my data descending, the empty cells are at the top.
How can I achieve the empty cells to be at the bottom no matter whether I sort my data ascending or descending?

Answers

  • allanallan Posts: 63,464Questions: 1Answers: 10,466 Site admin

    Hi,

    I wrote a blog post on this topic a while back. The post only covers string and number sorting, but the technique shown there could readily be expanded to modify the moment sorting plug-in.

    Allan

This discussion has been closed.