I have a datatables that list me the values as follows:
<table id="datatable_fixed_column" class="table table-striped table-bordered" width="100%">
<thead>
<tr>
<th>Protocolo</th>
<th>Assunto</th>
</tr>
</thead>
</table>
Javascript
$(document).ready(function() {
var otable = $('#datatable_fixed_column').DataTable({
"processing": true,
"serverSide": true,
"ajax": "server_processing/protocolos.php",
"order": [[ 0, "asc" ]],
"columnDefs": [
{ "width": "20%", "targets": 0 },
{ "width": "80%", "targets": 1 },
],
"sDom": "<'dt-toolbar'<'col-xs-6'f><'col-xs-6'<'toolbar'>>r>"+
"t"+
"<'dt-toolbar-footer'<'col-xs-6'i><'col-xs-6'p>>"
});
$("div.toolbar").html('<div class="text-right"><img src="img/logo2.png" alt="SmartAdmin" style="width: 111px; margin-top: 3px; margin-right: 10px;"></div>');
})
I would like to include in this table one more column with a button to edit, like this:
<form method="post" action="">
<input type="hidden" id="idcontrib" name="idcontrib" value="<?=$protocolo?>">
<button type="submit" class="btn btn-warning btn-xs" name="edit_contrib">
Editar
</button>
</form>
Note that the variable $protocolo
would store the value of the protocol on that line.
How do I assign the value of the protocol to a variable?
I'm trying to reproduce something like this:
<table id="datatable_fixed_column" class="table table-striped table-bordered" width="100%">
<thead>
<tr>
<th>Protocolo</th>
<th>Assunto</th>
<th>Ação</th>
</tr>
</thead>
</table>
2134 Teste [Editar] ($protocolo = 2134)
9999 teste 2 [Editar] ($protocolo = 9999)