DataTable如何添加属性为Jquery的行?

DataTable How to add row with attributes Jquery?

我在 table 中使用 Datatable 插件。我通过 Jquery:

动态添加行
var t = $('#example').DataTable();
 t.row.add( [
    counter +'.1',
    counter +'.2',
    counter +'.3',
    counter +'.4',
    counter +'.5'
] ).draw();

这里是fiddleDemo。但是我还没有找到任何东西我如何在 <tr>?

上添加属性

根据我的需要,我想添加 data-idclassid 和任何其他属性。

这就是我解决问题的方法:

var data = [
    counter +'.1',
    counter +'.2',
    counter +'.3',
    counter +'.4',
    counter +'.5'
];
var rowIndex = t.fnAddData(data);
var row = t.fnGetNodes(rowIndex);
$(row).attr( 'id', 'MyUniqueID' );

Working DEMO and Details