【发布时间】:2012-07-03 05:53:20
【问题描述】:
这是代码..
$.fn.dataTableExt.oSort['us_date-asc'] = function (a, b) {
var x = new Date(a),
y = new Date(b);
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
};
$.fn.dataTableExt.oSort['us_date-desc'] = function (a, b) {
var x = new Date(a),
y = new Date(b);
return ((x < y) ? 1 : ((x > y) ? -1 : 0));
};
var oTable = $('#example').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
//"bSortClasses": false,
"aoColumns": [
null, null,
{
"sType": "us_date"
},
null,
{
"bSortable": false
}],
"aaSorting": [
[2, "desc"]
]
});
我正在为数据表使用此代码以使第三列可排序。 我想以 jun-06-2012 格式显示日期。当我使用 06-06-2012 格式时,排序工作正常......但是当月份按字母顺序表示时,排序不起作用(它在 chrome 中有效,但在其他浏览器中无效) ... 我该如何解决这个问题?任何帮助将不胜感激
【问题讨论】:
标签: jquery datatables