Updated to reflect the data in Table 1.10.x. The initial response was aimed at 1.9.x. It is still applicable, but the API 1.10.x method is more powerful:
$("#add").click(function() {
var row = table.row.add([
'new',
'new',
'new',
'new',
'new'
]).draw();
row.nodes().to$().addClass('newRow');
});
1.10.x demo → http://jsfiddle.net/0scq8rkm/
In 1.10.x, you return an API object by holding a string. nodes().to$()allows you to work with the internal string node, since it was a jQuery object.
, <tr> :
tr.newRow {
background-color: red;
font-size: 20px;
}
:
<button id="add">add new row</button>
, , rowindex <tr>, fnGetNodes:
$("#add").click(function() {
var rowIndex = dataTable.fnAddData([
'new',
'new',
'new',
'new',
'new'
]);
var row = dataTable.fnGetNodes(rowIndex);
$(row).removeClass().addClass('newRow');
});
. → http://jsfiddle.net/q4E3Y/