I am trying to use this method https://datatables.net/examples/api/add_row.html, my table is consisting of several different HTML elements, they are of the type select and input. I have simplified it here to one input and one column only. My goal is to click the 'add row' button and add an exact row with all the elements to the table. But when I click the 'add row' button The number of entries gets incremented, in the console there is no error or warning, but still I do not see a new row being added to the table.
<table id="myTable">
<thead>
<tr>column header 1</tr>
<tr>column header 2</tr>
</thead>
<tbody>
<tr id="myRow">
<td id="colorField>
<input id="color">
</td>
</tr>
</tbody>
</table>
The JS part:
$(document).ready(function() {
var t = $('#myTable').DataTable();
$('#addRow').on('click', function(){
var jRow = $('#myRow');
jRow.id = "myRow2"; //I thought about changing the id but also not effective
t.row.add(jRow).draw();
});
});