So the question has already been asked here, but the solution doesn\'t work for me (I might do something wrong). I want to sort my tables by alphabetical order (\"type\" : \
Ok I found a solution for my second problem , see Here
So destroy the dataTable just before my ajax request and rebuild it on success :
else{
// Destroy dataTable
$('#classement').dataTable().fnDestroy();
$.ajax({
type: "POST",
url: "ajax.php",
data: {},
success: function(msg){
// Reload dataTable with sorting
$('#classement').dataTable({
columnDefs: [
{type: 'non-empty-string', targets: [2,3]} // define 'name' column as non-empty-string type
]
});
}
});
}
Example : JsFiddle