How to sort datatables with date in descending order

前端 未结 14 1968
我寻月下人不归
我寻月下人不归 2020-12-29 11:11

I wish to show the records using datatables with default ordering based on one of my rows with date & time in descending order. Please help me in editing the jquery stru

14条回答
  •  萌比男神i
    2020-12-29 11:41

    I got the solution with the sorting of date. Just add type as 'date' and in targets, you have pass column number(count start from 0) with datatable options. And set 'order' with column number and type of format. See below code,

    columnDefs: [ { type: 'date', 'targets': [4] } ],
    order: [[ 4, 'desc' ]]
    

提交回复
热议问题