Replacing empty date with string
Replacing empty date with string
bczm8703
Posts: 16Questions: 5Answers: 0
would like to check if it is possible to replace the cell with an empty date with a string, eg: Never, and this string should not affect the sorting of the date. this string is to be sorted at last.
Answers
It depends on what you are using.
If you are using columns.data
https://datatables.net/reference/option/columns.data
it is easy. Just use a renderer.
If you are not using columns data you need to work with cell().data().
https://datatables.net/reference/api/cell().data()
Sorting: Same thing, it depends on what you are using.
Sorting using a modified version of this plugin: https://datatables.net/plug-ins/sorting/datetime-moment
Here is a modified version that sorts "Never" to the end (if DD.MM.YYYY is your date format; you would need to adjust this):