I have the following code:
$.extend($.fn.dataTableExt.oSort, {
"datetime-uk-pre": function (a) {
from = a.split(' ');
var ukDatea = from[0].split('/');
var ukTimea = from[1].split(':');
return (ukDatea[2] + ukDatea[1] + ukDatea[0] + ukTimea[1] + ukTimea[0]) * 1;
},
"datetime-uk-asc": function (a, b) {
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"datetime-uk-desc": function (a, b) {
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
});
$.extend($.fn.dataTableExt.oSort, {
"date-uk-pre": function (a) {
var ukDatea = a.split('/');
return (ukDatea[2] + ukDatea[1] + ukDatea[0]) * 1;
},
"date-uk-asc": function (a, b) {
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"date-uk-desc": function (a, b) {
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
});
I read about about extend but still don't understand what it is doing. Can someone help explain this. What I am looking for is a simple explanation as possible. Also can I combine these two code blocks in some way.
This is code to give datatables a different way to sort. But what does it mean:
$.fn.dataTableExt.oSort