The rows of oTable datatable has unique ids.
Why this code doesnt work?
oTable.fnDeleteRow(
oTable.fnGetPosition(
$('#row'+id+'-tr')));
the error is:
[18:10:44.631] nNode.nodeName is undefined @ http://localhost: ... /jquery.dataTables.js:1903
Thank you!
edit:
Example:
<table>
<thead>
<th>
<td>Name </td>
<td>Delete</td>
</th>
</thead>
<tbody>
<tr id="row0-tr">
<td> Row 0 </td>
<td> <Button onclick="deleteRow(0)"> - </td>
</tr>
<tr id="row1-tr">
<td> Row 1 </td>
<td> <Button onclick="deleteRow(1)"> - </td>
</tr>
<tr id="row2-tr">
<td> Row 2 </td>
<td> <Button onclick="deleteRow(2)"> - </td>
</tr>
</tbody>
</table>
edit 2:
The real problem is: How to get row of table using id?
The method fnGetPosition($('#row'+id+'-tr') isn’t returning row.
I put this code before calling fngetPosition: console.log($('#row'+id+'-tr')) and
returns: ({length:1, 0:({}), context:({}), selector:"#row1-tr"})
Thanks for help!
The answer: