I want to add row using data datatables, and I can do it like this
var table = $('#mytable').DataTable();
table.add.row(['first column', 'second column', 'three column', 'etc']);
What I need is something like this (some attribute in TR and TD tag)
<tr id="someID">
<td>first column</td>
<td>second column</td>
<td>three column</td>
<td id="otherID">etc</td>
</tr>
How I can do it with datatables?
Use
createdRow
andcolumns.createdCell
options to define a callback function that will be called whenTR
andTD
element are created.See this example for code and demonstration.