fnDeleteRow does not accept a jquery object
fnDeleteRow does not accept a jquery object
rkralston
Posts: 3Questions: 0Answers: 0
Code:
function deleteClick(btn){
var tablerow=$(btn).closest('tr').get(0);
var id=$(btn).attr("value");
$.ajax({
url:'/com/PlatformHelper.cfc?method=deleteCollection&platformID=#platform.getID()#&collectionID=' + id,
method:'POST',
success:function(){
$('##collections').dataTable().fnDeleteRow(tablerow);
},
error:function(jqXHR, textStatus, errorThrown){
alert(textStatus + ':\n\n' + errorThrown);
}
});
return false;
}
Issue: calling fnDeleteRow without using .get(0) on tablerow deletes the first row. Pulling the DOM object out of the jQuery object with .get(0) works fine.
function deleteClick(btn){
var tablerow=$(btn).closest('tr').get(0);
var id=$(btn).attr("value");
$.ajax({
url:'/com/PlatformHelper.cfc?method=deleteCollection&platformID=#platform.getID()#&collectionID=' + id,
method:'POST',
success:function(){
$('##collections').dataTable().fnDeleteRow(tablerow);
},
error:function(jqXHR, textStatus, errorThrown){
alert(textStatus + ':\n\n' + errorThrown);
}
});
return false;
}
Issue: calling fnDeleteRow without using .get(0) on tablerow deletes the first row. Pulling the DOM object out of the jQuery object with .get(0) works fine.
This discussion has been closed.
Replies
Allan