date-sorting

Datatable date sorting dd/mm/yyyy issue

北战南征 提交于 2019-11-26 09:07:03
问题 I am using a Jquery plugin called datatables Its fantastic, however I cannot get the dates to sort correctly according to the dd/mm/yyyy format. I have looked at their support formats but none of these fixes seem to work. Can anybody here help me please? 回答1: jQuery Solution Here is working jQuery solution. jQuery.extend( jQuery.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