I already looked for answers to my question, for example Datatables sorting time column or Custom sort durations using jQuery DataTables but I have not been able to find one which suits my problem. Therefore, here I am.
I am using the jquery Datables : https://datatables.net/ to display tables in my current project. I got tables with columns containing durations such as :
99:39:25
322:48:43
274:01:21
33:10:39
When I want to sort them out, the result is not correct :
99:39:25
33:10:39
322:48:43
274:01:21
I looked in the documentation for the sorting plug-ins (https://datatables.net/plug-ins/sorting/) but it did not help. I used the natural and time sorting and each time got the result above. Does anyone got an idea on how to proceed ?
This is what I am using to initialize the datatable in my HTML:
<script>
$(document).ready(function() {
$('.dataresults').DataTable({
"iDisplayLength": 25,
"searching": true,
"pagingType": "simple",
"order": [[7, "desc"]],
"columnDefs": [{
"type": 'time', "targets": [6,7]
}],
});
});
</script>