jQuery DataTables - Ordering dates by hidden column

前端 未结 1 1012
你的背包
你的背包 2020-12-21 14:59

I have been working for a couple of days with DataTables and I have this task: I need to disable the initial sorting and filter the first column which contains dates like

相关标签:
1条回答
  • 2020-12-21 15:37

    SOLUTION

    You need to use columnDefs to target first column (targets: 0) and define the column which data would be used for sorting of the first column with orderData. Also you need to hide forth column (targets: 3) with visible: false.

    $("#TableBt" + rid).DataTable({
       columnDefs: [
           { targets: 0, orderData: 3 },
           { targets: 3, visible: false }    
       ]
    });
    

    DEMO

    See this jsFiddle for code and demonstration.

    0 讨论(0)
提交回复
热议问题