【发布时间】:2014-08-29 04:25:28
【问题描述】:
我有这个警告
DataTables 警告(表 id = 'datatabledetail'):意外数字 TD 元素。预期为 3,得到 0。DataTables 不支持 表体中的rowspan / colspan,并且必须有一个单元格 每行/列组合。
当我的桌子是空的,
我该怎么办??
这是我的数据表代码
var oTableDetail = $('#datatabledetail').dataTable({
"bSort": false,
"bAutoWidth": false,
"bProcessing": false,
"bFilter": false,
"bPaginate": false,
"aoColumns": [
{ "mDataProp": "Id", "bVisible": true },
{ "mDataProp": "CodeValue", "bVisible": true },
{ "mDataProp": "NameValue", "bVisible": true }
]//
,
"aoColumnDefs": [
{
"fnRender": function (o) {
return "<center> <input type='button' id='" + o.aData['Id'] + "' class='cremove mws-button blue' value='Remove'></center>";
},
"aTargets": [0]
}
]
});
这是我的 html 代码
<table cellpadding="0" cellspacing="0" border="0" class="mws-table" id="datatabledetail"
width="100%">
<thead>
<tr>
<th style="text-align: center; width: 5%;">
Action
</th>
<th style="text-align: center; width: 40%;">
Food Name
</th>
<th style="text-align: center; width: 10%;">
Food Code
</th>
</tr>
</thead>
<tbody>
<tr>
</tr>
</tbody>
</table>
【问题讨论】:
-
显示数据表代码...
-
你可以设置一个条件,如果你得到一些数据而不是应用数据表,否则不应用数据表只是显示空表。
标签: javascript jquery asp.net datatable