我的桌子有问题。我正在看" Processing"当我尝试排序或分页时,标签被冻结,我看到JSON正在生成正常,这是我的表设置我知道很重但我希望你能帮助我。
var dt =$('#mainDataOutputTable').DataTable( {
bFilter:false,
pageLength : 10,
info: false,
columnDefs: [ { orderable: false, targets: [7 ] }],
processing: true,
serverSide: true,
ajax: {
url: 'firstreport_ajax.cfm',
type: 'POST'
},
colReorder: true,
"columns": [
{ "data": "status"},
{ "data": "supervisor"},
{ "data": "type"},
{ "data": "date"},
{ "data": "shift"},
{ "data": "name"},
{ "data": "contract"},
{ "data": "desc"},
{ "data": "status"},
{ "data": "id"} ,
{ "data": "datecreated"}
]
} );
这是一个示例JSON文件
{
"sEcho": 5,
"iTotalRecords": 150,
"iTotalDisplayRecords ": 150,
"aaData": [
{
"status": "Open",
"supervisor": "Ahmed",
"type": "t",
"date": "30-Jan-2014",
"shift": "First",
"name": " Anthony",
"contract": "No",
"desc": "test",
"id": "1",
"datecreated": "30-Jan-2014"
}
]
}
答案 0 :(得分:1)
您正在使用jQuery DataTables 1.10,但服务器端处理参数来自DataTables 1.9的早期版本。升级到1.10时,请参阅this note有关服务器端处理的信息。
在DataTables初始化代码之前添加$.fn.dataTable.ext.legacy.ajax = true
以强制jQuery DataTables使用旧方案。