【发布时间】:2012-12-13 11:11:37
【问题描述】:
我正在使用datatables plugin。
我的表包含一个列名 css,其中包含该行中列的 css。
例如,数据库中的表如下,
Name Priority Percent CSS
---------------------------------------------------------
abc high 50 .priority{color:red} .percent {color:yellow}
xyz low 70 .priority{color:green} .percent {color:green}
pqr medium 10 .priority{color:yellow} .percent {color:red}
现在在显示数据表时,我不想包含 css 列,但我想在特定单元格上应用 css。 我正在尝试实现以下目标,
$('#example').dataTable({
"fnRowCallback": function (nRow, aData, iDisplayIndex, iDisplayIndexFull) {
$(row).children().each(function(index, td){
// perform operation here
});
return nRow;
}
我不明白如何使用来自同一行的 <td> 的 css 为特定的 <td> 添加 css。
请帮忙
【问题讨论】: