可以在dataTables的onCellRender中通过列获取对应的单元格设置其背景颜色,如下
Model.prototype.listDataCellRender = function(event) {
var dataTables = event.source;
var row = event.row;
if (event.colName == 'fName' && event.colVal == 'andTest') {
setTimeout(function() {
var cell = dataTables.getCell(row, event.colName);//获取单元格
if (cell) {
var $td = $(cell.node());//获取单元格的td
$td.css("background-color", "red");
}
}, 1);
}
};
评一波