0
I have the following datatable:
function retorna_cliente()
{
$(".mostra_clientes .table").dataTable({ "bDestroy": true }).fnDestroy();
$('.mostra_clientes .table').DataTable({
"pageLength": 4,
"ajax": {
"url": url_base + "clientes",
"type": "GET",
"dataSrc": ""
},
"columns": [
{ "defaultContent": "<input type='checkbox' value='AQUI VEM O 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,
});//.fnDestroy();
In the checkbox field I need to take the ID that comes from the given.id to edit and delete a client. How do I do this using Datatable? How do I pass the ID to this checkbox?
I found an example here: https://jsfiddle.net/gyrocode/abhbs4x8/, but I didn’t quite understand the logic.
I use Datatable with a slightly different return, but the ID always returns as Dt_rowid if I’m not mistaken, I don’t know if I could help you....
– Leo Nogueira
@Leonogueira. What would that be like? I need to take each client’s ID and put it in that checkbox in order to edit the client. Have some concrete example?
– Felipe Michael da Fonseca