row.remove is not working
row.remove is not working
![rooshak](https://secure.gravatar.com/avatar/079b7d3f8339045af2801b67e804170f/?default=https%3A%2F%2Fvanillicon.com%2F079b7d3f8339045af2801b67e804170f_200.png&rating=g&size=120)
http://debug.datatables.net/etixon - my debug link,
var otherTable = function(){
var t = $('#otherTable').DataTable({
"info": false,
"paging": false,
"searching": false,
"ordering": false
});
var counter = 0;
$(document).on('click', '#add-row-other', function (e) {
e.preventDefault();
t.row.add( [
'<input type="text" class="form-control" name="org_name['+[counter]+']" >',
'<input type="text" class="form-control" name="org_addr['+[counter]+']" >',
'<input type="text" class="form-control" name="org_amount['+[counter]+']" >',
'<button type="button" id="delete-row" class="btn btn-danger delete"><i class="glyphicon glyphicon-trash"></i> <span>Delete</span></button>',
] ).draw();
counter++;
});
$('#otherTable').on('click', '#delete-row', function (e) {
e.preventDefault();
//console.log(t.row);
t.row.remove($(this).parents('tr')).draw();
});
};
TypeError: t.row.remove is not a function
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
It isn't :-). You want
row().remove()
- i.e. -t.row( ... ).remove().draw();
.Btw, the code above suggests you might have more than one element with the ID
#delete-row
- which isn't going work. Ids must be unique in HTML.Allan
Thank you allan.. I made a silly mistake. I just tested this using one row that's why I used an ID..