【发布时间】:2012-08-05 10:23:04
【问题描述】:
我有一个将 json 数据加载到 jquery dataTable 中的函数
(...)
success: function (response) { LoadData(response.d); }
(...)
function LoadData(data)
{
$('#tableAnalysis').dataTable({
"aaData" : data
});
}
我的“数据”如下所示:
{"d":[{"Key":"sometext","Value":891},{"Key":"someothertext","Value":287},{"Key":"moretext..","Value":233}]}
我的 html 表格如下所示:
<table id="tableAnalysis">
<thead>
<tr>
<th>Label</th>
<th>Frequency</th>
</tr>
</thead>
<tbody>
<tr>
</tr>
</tbody>
</table>
我不断收到“警告 - 添加的数据与已知的列数不匹配”。
我应该如何处理我的“数据”,以便为 dataTables 提供正确的格式?正确的格式是什么?
谢谢!
【问题讨论】:
标签: javascript jquery json jquery-plugins datatables