Can't run .fnDraw()
Can't run .fnDraw()
jandante
Posts: 10Questions: 4Answers: 0
Hi,
I don't seem to be able to run fnDraw() => TypeError: tableRelations.fnDraw is not a function.
This is my initialisation code + the code that should do a fnDraw after my delete operation is finished:
var tableRelations;
tableRelations = $('#relations').DataTable({
processing: true,
serverSide: true,
order: [ 1, 'asc' ],
ajax: "php/datatables/get_relations.php",
language: dutchDataTable
});
$('#confirmed-delete').on('click', function(){
var toDelete = $('#relations').find('.selected').attr('id');
$.ajax({
type: 'POST',
url: 'php/delete_relation.php',
data: {id: toDelete, links: linkedContact, tasks: tasksContact}
}).done(function(data){
if (data == 'success') {
tableRelations.fnDraw();
$('#confirm-delete').modal('hide');
$(".selectedRelation").hide();
} else {
console.log('Error: ' + data);
}
});
});
I suppose this is something trivial, but I don't see the difference with examples here or on stack...
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Second top FAQ :-)
Btw, I'd suggest using the new API -
draw()
rather than the oldfn*
functions. In which case$().DataTable()
is the correct option to use.Allan
Thank you (again :)).
I was indeed going for an API instance but used the wrong function :). Thanks!