Is it possible to add ID to last added row with jQuery DataTables (e.g., <tr id="myid">...</tr>
) ?
$('#example').dataTable().fnAddData( [
"col_value_1",
"col_value_2",
"col_value_3",
"col_value_4" ] );
(Add id to this new row)
If you use row.add() it is easy to set the id:
The .node() returns the element of the newly added row.
Use the fnCreatedRow/createdRow Callback. It is best to set the id attribute of the table row on creation of the row. Use what the API has provided and you won't need to hack it or have messy code
Here is a more cleaner approach that I found here:
This worked for me
Hope below code will help you
This worked for me
rowNode.id='myId';