【发布时间】:2013-04-09 03:53:49
【问题描述】:
我是数据表 jquery 插件的新手。 我被这个问题困住了超过 2 天。我有一个 Json 数据,我仍然无法加载表,我还想将第一列分配为行的 id
这里是html:
<table cellpadding="0" cellspacing="0" border="0" class="display"
id="accDetailTable">
<thead>
<tr>
<th>Currency</th>
<th>Current/Savings Account No.</th>
<th>Securities Account No.</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
还有我的初始化
var oTable=$('#accDetailTable').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": contextPath + "/user/investorAjax?method=getInvestorAccDetailList",
"iDeferLoading": 57,
} );
从服务器返回 jsonData:
{"sEcho":1,"iColumns":4,"iTotalRecords":16,"iTotalDisplayRecords":16,
"aaData":
[{"DT_RowId":2032,"currency":1,"currentAccNo":"aa","secureAccNo":"aa"},
{"DT_RowId":2033,"currency":1,"currentAccNo":"111","secureAccNo":"111"},
{"DT_RowId":2034,"currency":1,"currentAccNo":"a","secureAccNo":"aa"},
]}
}
但它总是命中:
DataTables 警告(表 id = 'accDetailTable'):添加的数据(大小未定义)与已知列数不匹配 (3)
【问题讨论】:
-
如何添加另一个隐藏列来保存行ID?
-
我尝试再添加一个标题
id 并将其样式设置为隐藏。但它显示:添加的数据(大小未定义)与已知的列数(5)不匹配。从 3 跳到 5 ,还是不知道为什么
标签: javascript datatables