I need to sort a column in jQuery DataTables. I tried using the moment plugin without success.
The column contains call duration but it's not always there so we use N/A for those. Column data looks like:
2m 45s
1m 32s
N/A
45s
1m
I need to be able to sort these with the N/A valuing less than 0 and the rest to be in the logical order
I use jQuery DataTables 1.10.6, moment 2.9.0 and I do have all the datatables plugins. I use data-stype is th in the header of my table. I also use the no config datatable init looks like that
// Create DataTables User
table = $('#summary-table').DataTable({
'language' : { "url": paths.lang_{{LaravelLocalization::getCurrentLocale()}} },
'responsive':
{
'details':
{
'type': 'inline'
}
},
'order': [[(nbCat + 5), 'desc']],
'dom': '<"row"<"col-sm-12 before-table
"<"table_controls">>r><"row"<"col-sm-12"t>><"row"<"col-sm-12"ipl>>',
'lengthMenu': [[20, 50, 100, -1], [20, 50, 100, transAll]],
});