【发布时间】:2018-11-22 23:07:29
【问题描述】:
我有一个 jquery 数据表,其中日期列格式为 2018 年 2 月 16 日,但排序时没有正确排序。
我已经使用了Here提到的所有与日期相关的列类型
但似乎没有任何效果。我该如何解决?
这里是代码
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="panel-body btnsize">
<table class="table table-striped table-bordered dttable" id="JsDataTable" style="border-radius: 17px 17px 0 0; border-style: solid; border-color: #fcfdfa;" width:100%;>
<thead>
<tr>
<th style="width: 1px !important;" class="tblth">
Sr
</th>
<th class="tblth" style="width:13% !important;">
Date <i class="fa fa-fw fa-sort"></i>
</th>
</tr>
</thead>
<tbody class="dtbody tblth" style="color: #004D6B;">
</tbody>
</table>
</div>
var table = $("#JsDataTable").DataTable({
scrollY: '50vh',
scrollCollapse: true,
"aaData": response,
"pagingType": "full_numbers",
"dom": '<"top"i>rt<"bottom"flp><"clear">',
"sDom": 'Rfrtlip',
"bInfo": true,
"lengthMenu": [
[10, 20, 30, -1],
[10, 20, 30, "All"]
],
"columnDefs": [{
"searchable": false,
"orderable": false,
"targets": [0, 1, 2, 3, 4],
"type": 'natural'
}],
"order": [
[1, 'asc']
],
"aoColumns": [{
"mData": null
},
{
"mData": "Date",
'bSortable': true,
"sType": "natural"
},
],
"searching": true,
"paging": true,
"bAutoWidth": false,
"fixedColumns": false,
//order: [],
});
【问题讨论】:
-
你能把你的代码贴在这里吗?
-
还要加html代码!!
-
@BhumiShah 请看我已经编辑了我的问题。
-
我的意思是你的回应。我想看看你的日期格式
-
在我的情况下,我们如何在 jquery 数据表中对不同的日期格式进行排序,特别是这个(2018 年 2 月 16 日)?
标签: jquery datatables datatables-1.10