adding and removing row by id ?
adding and removing row by id ?
My table reflects users.
I can add some rows (adding some html), but I cannot affect an unique id to them.
My goal would be to haev functions such as:
function addUser(username) {
// add a row() whose id=username
}
function removeUser(useranme) {
// remove a row () whose id=username
}
Any clue to acheieve that ?
Thanks
I can add some rows (adding some html), but I cannot affect an unique id to them.
My goal would be to haev functions such as:
function addUser(username) {
// add a row() whose id=username
}
function removeUser(useranme) {
// remove a row () whose id=username
}
Any clue to acheieve that ?
Thanks
This discussion has been closed.
Replies
[code]
var table = $('#myTable').DataTable();
// Remove a row by Id:
table.row('#myId').remove().draw();
// Likewise to add a new row:
table.row.add( $('...') ).draw();
[/code]
Among other options. It is possible in 1.9- but a fair bit more complicated.
Allan
I don't see any available links for 1.10.
regards
$('#tableUsers').dataTable().row.add( ('zazaza') ).draw();
Uncaught TypeError: Cannot call method 'add' of undefined
Note the uppercase `D` in my example - `$('#tableUsers').DataTable(` . The uppercase version gives yo the DataTales API object.
Allan