我对表格有一个非常好的样式。DataTables:如何设置类到表格单元格(但不是表格单元格!)
{对不起环节没有更多的工作}
我不得不添加的sclass使(由fnAddData加)新行得到正确的类。
不幸的是,废墟我的布局,因为这些类也添加到我的表格标题单元格!
{对不起环节没有更多的工作}
如何配置的sclass只适用于TBODY细胞?
澄清:
var rolesTable = $('#roles').dataTable({
"aoColumns": [
{ "mDataProp": "id", "sClass": "avo-lime-h avo-heading-white" },
{ "mDataProp": "name", "sClass": "avo-light" },
{ "mDataProp": "module", "sClass": "avo-light" },
{ "mDataProp": "description", "sClass": "avo-light" },
{ "mDataProp": null, "bSearchable": false, "bSortable": false,
"sDefaultContent": '<button type="button" name="add" class="btn"><i class="icon-plus icon-white"></i></button>' },
],
}); // end od dataTable
这样,当我打电话
rolesTable.fnAddData({
"id": 10,
"name": "testname",
"module": "testmodule",
"description": "testdescription"
});
那么添加的行看起来是这样的:
<tr>
<td class="avo-lime-h avo-heading-white">10</td>
<td class="avo-light">testname</td>
<td class="avo-light">testmodule</td>
<td class="avo-light">testdescription</td>
<td></td>
</tr>
而且是完全OK
**问题**这个设置也增加了这些类:
<thead>
<tr> (...) </tr>
</thead>
表头细胞......我不想
请发布与问题相关的代码。理想情况下,**除了问题主体本身的代码之外,还请添加[jsFiddle.net/api/post/jquery/1.7.1/]您问题的示例。它会帮助我们帮助你。 –
我不知道我可以标记“接受”没有upvoting答案...直到最近我的分数太低,无法upvote – loostro