日付列のソートに問題があります。私の日付はこの形式です
Y-m-d H:i:s
そして、私はこの出力を得ています:
2012-04-14 23:07:00
2012-01-14 22:40:14
2012-03-09 19:03:20
2012-03-12 16:00:28
2012-05-01 16:09:38
2012-02-11 05:07:08
2012-01-17 15:15:09
2012-03-10 16:02:20
2012-02-09 14:33:19
これは私の初期化です:
$(document).ready(function() {
oTable=$('#jphit').dataTable( {
"sDom": 'T,C<"clear">lfrtip',
"oTableTools": {
"sSwfPath": "swf/copy_csv_xls_pdf.swf"
},
"oColVis": {
"buttonText": "Extend table",
"activate": "mouseover"
},
"aoColumnDefs": [
{ "bVisible": false, "aTargets": [ 2 , 4 , 6] }
],
"aoColumns": [
{
"mDataProp": null,
"sClass":"center",
"sDefaultContent": '<img src="images/plus-icon.png" style="width:27px; height:27px;display: inline;">'
},
{ "mDataProp": 0 }, //date column
{ "mDataProp": 1 },
{ "mDataProp": 2 },
{ "mDataProp": 3 },
{ "mDataProp": 4 },
{ "mDataProp": 5 },
{ "mDataProp": 6 }
],
"aaSorting": [[0,'desc']], //sort date column
"bProcessing": true,
"bSort": true,
"sPaginationType": "full_numbers",
"bServerSide": true,
"sScrollY": "500px",
"bDeferRender": true,
"sAjaxSource": "history_table.php"
} );
これは私のPHP部分です:
$aRow[$iTimestampCol] = date( 'Y-m-d H:i:s', $aRow[$iTimestampCol] );