Deleting rows based on checkboxes

Deleting rows based on checkboxes

ITDBITDB Posts: 2Questions: 0Answers: 0
edited October 2010 in General
I want to do something pretty basic - each row in the table has a checkbox, and I want a button to remove all the rows where the box is checked. Seems easy enough, but every variation I try fails. Shouldn't something like the below work? I've also tried using the position instead of the row itself. If anything happens at all, it's not deleting the right rows. For example, this causes it to just delete the last row instead of the row with the checked checkbox in it.

[code]
$(document).ready(function() {
var oTable = $('#testTable').dataTable();
$('#deleteButton').click(function() {
$('input:checked').each(function() {
//the parent is the , the parent's parent is the
var tempRow = $(this).parent().parent();
oTable.fnDeleteRow(tempRow);
});
});
});
[/code]
This discussion has been closed.