"render": function ( data, type, row ) { // Bitcointalk //nu

"render": function ( data, type, row ) { // Bitcointalk //nu

capcoincapcoin Posts: 6Questions: 2Answers: 0

Hi,

I try to custom a cell of my datatable with "render". That's work fine but I've an alert error when I load the table:
"DataTables warning: table id=data_index - Requested unknown parameter '7' for row 0, column 7"

Here my datatable declaration:

$(document).ready(function() {
$('#data_index').DataTable( {
"ajax": 'data_index.php',
"iDisplayLength": 100,
"columnDefs": [
{
"render": function ( data, type, row ) {
if(data > 0)
return row[7]+"%";
},
"targets": [ 7 ]
}
]
} );
} );

Here my JSON:

{
"draw":1,
"recordsTotal":0,
"recordsFiltered":0,
"data":[
[
1,
"bitcoin",
"Bitcoin",
"3567.06",
"59112700000",
"0.23",
0,
0,
0,
"https:\/\/www.reddit.com\/r\/Bitcoin\/",
"326400",
923,
"Bitcoin",
"325888",
906
]
]
}

Do you have an idea ?

Answers

This discussion has been closed.