【发布时间】:2017-04-17 09:19:30
【问题描述】:
我还是数据表的新手。我的日期格式如下 01/10/2011 10:10 AM,我想对其进行排序。我已经阅读了可用的插件,但我仍然无法正确排序,因为它只根据日期而不是月份和年份进行排序。
<script type="text/javascript" src="datatables/datatables.net/js/jquery.dataTables.js"></script>
<script type="text/javascript" src="cdn.datatables.net/plug-ins/1.10.13/sorting/date-euro.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#test').dataTable({
"columnDefs": [{
"type": "date-euro",
targets: 1
}]
});
});
</script>
<?php $filetime = date("d/m/Y H:i A",filemtime($dir.'/'.$basename)); ?>
<table id="test">
<thead>
<tr>
<th>Name</th>
<th>Date Modified</th>
</tr>
</thead>
<tbody>
<tr>
<td>Test</td>
<td><?php echo $filetime; ?></td>
</tr>
</tbody>
【问题讨论】:
-
一个类似的问题/例子stackoverflow.com/questions/43448024/…
-
在这种情况下尝试自定义排序功能datatables.net/examples/plug-ins/dom_sort.html
标签: javascript php jquery html datatable