[英]How to sort date column in Datatables framework?
I'm trying to make a date column sortable by date but it only sorts by the day.我正在尝试使日期列按日期排序,但它只按天排序。
URL to my example: https://aetos-us1.infinitybht.app/store/81113d0060/?ui=dashboard ( click on "Requests", then sort the "Creation Date" column.) URL 到我的示例: https://aetos-us1.infinitybht.app/store/81113d0060/?ui=dashboard (单击“请求”,然后对“创建日期”列进行排序。)
The js code I'm using:我正在使用的js代码:
$.fn.dataTable.moment( 'ddd.mm.YYYY HH:mm' ); $.fn.dataTable.moment('ddd.mm.YYYY HH:mm');
$('#requests_table').DataTable( {
"columnDefs": [
{ "type": "datetime-moment", targets: 6 }
],
)}
Thanks for helping me in this.感谢您在这方面帮助我。
You can try this你可以试试这个
Ref: http://jsfiddle.net/mlotfi/6gzpnjgx/参考: http://jsfiddle.net/mlotfi/6gzpnjgx/
var table = $('#example').DataTable({
columnDefs : [
{ type: 'time-date-sort',
targets: [6],
}
],
order: [[ 6, "desc" ]]
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.