I have a problem in DataTables that is making me sleepy. I have the following code. It even displays the datatable but the table functions do not work. The next does not appear nor the prev. If I remove the destroy it returns in the message: Warning: Can not reinitialise DataTable. What could it be?
function retorna_cliente()
{
// $('.mostra_clientes .table').DataTable().destroy();
var oTable = $('.mostra_clientes .table').DataTable({
"pageLength": 4,
"ajax": {
"url": url_base + "clientes",
"type": "GET",
"dataSrc": "",
},
"columns": [
{
"data": function ( data, type, row ) {
return "<input type='checkbox' value='"+data['id']+"' name='verifica_check_box[]' id='verifica_check_box' class='flat'/>";
}
},
{ "data":"nome"},
{ "data":"data_nascimento"},
{ "data":"telefone"},
{ "data":"celular"},
{ "data":"cpf"},
{ "data":"endereco"},
{ "data":"email"},
], language: {
"sProcessing": "Carregando...",
"sLengthMenu": "Mostrar _MENU_ registros",
"sZeroRecords": "Não foram encontrados resultados",
"sInfo": "Mostrando de _START_ até _END_ de _TOTAL_ registros",
"sInfoEmpty": "Mostrando de 0 até 0 de 0 registros",
"sInfoFiltered": "(filtrado de _MAX_ registros no total)",
"sInfoPostFix": "",
"sSearch": "Buscar:",
"sUrl": "",
"oPaginate": {
"sFirst": "Primeiro",
"sPrevious": "Anterior",
"sNext": "Seguinte",
"sLast": "Último"
}
},
//"bDestroy": true,
});
oTable.ajax.reload(null, false);
oTable.destroy();
}