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](https://secure.gravatar.com/avatar/511ab1f10803b4b0ae0360d8ded89670/?default=https%3A%2F%2Fvanillicon.com%2F511ab1f10803b4b0ae0360d8ded89670_200.png&rating=g&size=120)
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!