Remove table row from a button inside the same row (when collapsed)
Remove table row from a button inside the same row (when collapsed)
meldro
Posts: 6Questions: 1Answers: 0
Hello everybody,
i've got a responsive datatable with a "remove row" button inside the last column of each row.
I'm using this code to do that:
$('#example').on('click', '.remove', function () {
var table = $('#example').DataTable();
table
.row($(this).parents('tr'))
.remove()
.draw();
});
This the example (and the problem) : http://jsfiddle.net/hg5m209e/19/
The remove button works until the last column is collapsed in a new row... in this case my code fails.
The last column goes to a child row and brokes the code.
How can i fix that?
Thanks a lot!
This discussion has been closed.
Replies
Hi @meldro ,
This here should do the trick. Your problem is that the child details are a row themselves, so you need to parse past that to get to the original row,
Cheers,
Colin
Hi @colin ,
thanks for reply but your link shows my same code...
Do i miss something?
That's odd - it's still on my screen with the modified code. Try this one, but pasting code in case that also doesn't work.
@colin ... thanks a lot!