How to sort datatables with date in descending order

前端 未结 14 1961
我寻月下人不归
我寻月下人不归 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条回答
  •  北海茫月
    2020-12-29 11:22

    I had same problem. I used date-eu sorting plugin to sort dates in the format DD/MM/YY and I included the following JS file :

    
    

    This worked for me.

    $('#exemple').DataTable({
        "order": [[ 3, "desc" ]], //or asc 
        "columnDefs" : [{"targets":3, "type":"date-eu"}],
    });
    

    Read also this post on stackoverflow: Sorting date in datatable

提交回复
热议问题