I have a datatable that I use that has 5 columns ( http://datatables.net/ )
Columns
- Date in the format: Jan. 5
- Time in format: 10:31 (xx: xx XX)
- Columns 3, 4, 5 are not important, it's just data that I don't care about sorting if 1 and 2 are correct.
I want to sort by date FIRST (last), then I want to sort by time (most recent at the top).
So, on January 5, 16:58 should show until 4:58 in the morning, and, obviously, all other numbers should work just as well for all other times. The format is always the same, i.e.: 12:34, 16:15, 12:00, etc.
Today it already works great. There are only 2 days of max data in a datatable, so even when it flips before the 1st of the month, it will still be displayed at the top, which is good. I looked through the documentation and I'm confused how to do the correct sorting for my Time column.
Here is my code:
oTable = $('#posts').dataTable({
"bSort": true,
"aaSorting": [ [0,'desc'], [1,'asc'] ],
"aoColumns": [
null,
{ "sType": 'time-sort' },
null,
null,
null
]
});
This is from here: http://datatables.net/release-datatables/examples/basic_init/multi_col_sort.html
, - , sType "aoColumns" ( , ), , :( , . , , , ...
, , , . ( , ). 99% , , .
jQuery.fn.dataTableExt.oSort['time-sort-asc'] = function(x,y) {
return ???;
};
jQuery.fn.dataTableExt.oSort['time-sort-desc'] = function(x,y) {
return ???
};