Hello,
I use a simpleDateFormat "yyyy-MM-dd hh:mm:ss.SSS" to display a date in my datatable. I've to change this format to "yyyy-MM-dd HH:mm:ss.SSS" to have the 24H format.
But with this new format, the sort on date column is not working anymore, instead of a sort by date, it is doing an alphabetical sort. Although it was working with the previous format.
It is a matter of plugin I have to use or about code ?
This is my datatable :
$('#dataTables').DataTable({
responsive: false,
ajax: {
"url": restURI + 'orch/search/events/',
"contentType": "application/json",
"type": "POST",
"data": function ( d ) {
return JSON.stringify(getDatasToSearch());
},
error: function(jqXHR, textStatus, errorThrown){
manageAjaxError(jqXHR, textStatus, errorThrown)
}
},
buttons: [
'selectAll',
'selectNone'
],
language: {
buttons: {
selectAll: "Select all items",
selectNone: "Select none"
}
},
select: {
selector: 'td:first-child',
style: 'multi'
},
order: [0, 'desc'],
scrollCollapse: true,
scrollX: false,
aLengthMenu: [
[10, 25, 50, 100, -1],
[10, 25, 50, 100, "All"]
],
iDisplayLength: 25,
"columns": [
{ "data": "EVENT_ID", "defaultContent": "", "sClass": "text-center limitedWidth" },
{ "data": "FLOW_ID", "defaultContent": "", "sClass": "text-center limitedWidth" },
{ "data": "FLOW_NAME", "defaultContent": "", "sClass": "text-center limitedWidthFlNm" },
{ "data": "OBJECT_TYPE", "defaultContent": "", "sClass": "text-center limitedWidth" },
{ "data": "OBJECT_NAME", "defaultContent": "", "sClass": "text-center limitedWidth" },
{ "data": "OBJECT_VERSION", "defaultContent": "", "sClass": "text-center limitedWidth" },
{ "data": "OBJECT_ITERATION", "defaultContent": "", "sClass": "text-center limitedWidth" },
{ "data": "OPERATION_NAME", "defaultContent": "", "sClass": "text-center limitedWidth" },
{ "data": "OPERATION_STATUS", "defaultContent": "", "sClass": "text-center limitedWidth" },
{ "data": "OPERATION_MESSAGE", "defaultContent": "", "sClass": "text-center limitedWidth" },
{ "data": "CREATE_DATE", "defaultContent": "", "sClass": "text-center limitedWidth","sType":"date" },
{ "data": "UPDATE_DATE", "defaultContent": "", "sClass": "text-center limitedWidth " ,"sType":"date" }
]
})
Thank you for your help !