出於某種原因,它只會刪除第一行,不知道爲什麼。不刪除其他行
function templatesArray(whatsThis) {
var myNewArray = new Array();
var aRow = new Array();
$('input:checkbox[name="templates"]:checked').each(function(i) {
myNewArray.push($(this).val());
aRow.push(oTable.fnGetPosition($(this).parents('tr').get(0)));
});
var dataString = 'templatesArray=' + myNewArray + '&deleteTemplatesArray=True';
$.ajax({
type: "POST",
url: "processes/templates.php",
data: dataString,
success: function(data) {
if (data.errorsExist) {
} else {
$(whatsThis).parents("tr").eq(0).hide();
for (i in aRow) // loop over the array of row indexes
oTable.fnDeleteRow(aRow[i]);
if(oTable.fnSettings().fnRecordsTotal() == 0) {
$('.bt_red').remove();
$('.bt_blue').remove();
}
if(oTable.fnSettings().fnRecordsTotal() <= 10) {
$('.bt_blue').remove();
}
if(oTable.fnSettings().fnRecordsTotal() <= 10) {
$('div.pagination').remove();
}
}
}
});
}
什麼是oTable?標記在哪裏?你需要比1班輪和一些代碼更加冗長。 – madcapnmckay
http://jsfiddle.net/xtremer360/3Ldj5/它應該執行它所做的服務器端操作,然後從表中刪除該行,但僅執行數組中的第一個操作。 –
爲什麼我的文章被編輯? –