How could I change value of a cell using fnRowCallback ?
How could I change value of a cell using fnRowCallback ?
fernandopaiva
Posts: 6Questions: 1Answers: 0
I'm trying change a cell value using fnRowCallback but still haven't success.
how could I do this ?
I'm trying this.
$(document).ready(function() {
$('#dataTables-example').DataTable({
"processing": true,
"serverSide": true,
"ajax":{
url: "<?php echo $this->Html->url("/Empresas/indexAjax.json");?>",
dataSrc:""
},
"columns": [
{"data": "Empresa.id", sortable:false},
{"data": "Empresa.nomeFantasia"},
{"data": "Empresa.cnpj"},
{"data": "Empresa.telefone1"},
{"data": "Empresa.telefone2"},
{"data": "Empresa.celular"},
{"data": "Empresa.aberto", "fnRowCallback":function(nRow, aData, iDisplayIndex){
if(aData["Empresa"] === 1){
$('td', nRow).html("Aberto");
}else{
$('td', nRow).html("Fechado");
}
return nRow;
}}
]
This discussion has been closed.
Answers
I solved the problem.
I did.
Nice job