我有一个由服务器端ajax填充的jquery数据表。假定默认情况下,数据表应该是可排序的,而不必添加任何参数。我的不是。排序箭头显示在列标题中,单击它们会翻转箭头,但没有排序。
这是数据表定义:
$('#appPotTable').DataTable({
"ordering": true,
"processing": true,
"serverSide": true,
"ajax": "/MoneyMachine/screen_analystEst.php",
"columns": [
{ "data": "Symbol", "sortable":true },
{ "data": "CompanyName" },
{ "data": "StockType" },
{ "data": "ExDivDate" },
{ "data": "Dividend" },
{ "data": "DivYield" },
{ "data": "DivFrequency" },
{ "data": "DivPayDate" },
{ "data": "PriceToNav" },
{ "data": "AppreciationPotential" }
]
});
我已经尝试过使用和不使用“ ordering”和“ sortable”参数,但结果相同。我也尝试过各种列定义参数,但并不高兴。有建议吗?
答案 0 :(得分:0)
感谢Ogreucha建议关闭服务器端处理。我做到了,现在排序工作正常。这是新代码:
$('#appPotTable').DataTable({
"ajax": "/MoneyMachine/screen_analystEst.php",
"columns": [
{ "data": "Symbol" },
{ "data": "CompanyName" },
{ "data": "StockType" },
{ "data": "ExDivDate" },
{ "data": "Dividend" },
{ "data": "DivYield" },
{ "data": "DivFrequency" },
{ "data": "DivPayDate" },
{ "data": "PriceToNav" },
{ "data": "AppreciationPotential" }
]
});