3
I’m trying to add a button with the id from user to serverside datatables I have made several unsuccessful attempts, if anyone can help me I appreciate it.
This is my datatables code:
    $('#jsontable').dataTable({
"oLanguage": {
  "sUrl": "busca/pt-br.txt"
},
        "responsive": true,
        "processing": true,
        "serverSide": true,
        "ajax": "busca/busca_usuario.php"
});
This is the array of the search:
$columns = array(
    array( 'db' => '`a`.`nome`',         'dt' => 0, 'field' => 'nome' ),
    array( 'db' => '`a`.`cpf`',          'dt' => 1, 'field' => 'cpf' ),
    array( 'db' => '`a`.`situacao`',     'dt' => 4, 'field' => 'situacao'),
    array( 'db' => '`b`.`descricao`',    'dt' => 2, 'field' => 'descricao' ),
    array( 'db' => '`c`.`descricao`',    'dt' => 3, 'field' => 'nomegh', 'as' => 'nomegh' ),
);
That’s how the data comes in:
{"draw":1,"recordsTotal":28,"recordsFiltered":28,"data":[{"0":"ADRIANO TESTE","1":"0000000000","4"
:"ativo","2":"Aluno","3":"Aluno 1ª série"}]}
I was able to add the link to the column just to get the user id:
I leave my attempt to help others with the same doubt:
    $('#jsontable').dataTable({
"oLanguage": {
  "sUrl": "busca/pt-br.txt"
},
        "responsive": true,
        "processing": true,
        "serverSide": true,
        "ajax": "busca/busca_usuario.php",
         "aoColumnDefs" : [
            {"data": null, "sDefaultContent": "<a href=teste.php?id=' + data[0] + '>teste</a>","aTargets": [5]}
        ]
});
Thank you so much opeta a while ago I was with this problem and your solution saved me
– user38641