Error when add new row
Error when add new row
After many lines of code print the new row:
var Row = $(".contact").append("<tr id='""'><td class='nombre'></td><td class='categoria'></td><td class='movil'></td><td class='empresa'></td><td><a href='#' id='""' class='del'>Eliminar</a> <a href='#' id='""' class='edit'>Editar</a></td></tr>");
*I tried without "tr".
And then add the row to my table defined:
table.row.add(Row).draw();
And show this error: Uncaught TypeError: Cannot read property 'nodeName' of undefined
This question has an accepted answers - jump to answer
Answers
In the above code you are passing the
.contactelements into therow.add()method. Is that really what you want? Why not just pass in thetrHTML or element?Allan
Sorry, but I do not understand what you mean. I add a new row to the table. My problem is that DataTables not recognize the new row so if I try to interact with it removed.
Reading the code above you insert a
trelement into all.contactelements on the page. You then add those.contactelements (I don't know if there is more than one) to the table.Why not just do:
I don't understand why you would what to insert it into
.contactfirst.Allan
OK understood. The ".contact" is the name of the table.
I tried but it does not work well. Returns something strange screen. Pick up a character for each column.
1 column <
2 column t
3 column r
4 column
5 column i ...
Can you link to the page showing the issue so I can debug it then please.
edit The other thing you could try is
table.row.add( $(Row) ).draw().Thanks,
Allan
Perfect, it works. Thank you.
The web is not online yet.