I have the following table generated with Datatables:
Now, inside the Prize column, I want to create a common table (without datatables), the way I do it is by calling a function called insertTablePositionDraw;
"columns": [
{
"data": "prize_money",
"name": "draws.prize_money",
"mRender": function (data, wea, row, meta) {
return row.prize_money
? '$<strong>' + data + ' </strong>' +
'<i class="fa fa-bar-chart create-prize-money" aria-hidden="true" data-toggle="modal" data-target="#modalCreatePrizeMoney"></i>' +
'<br/>' + (row.positions != "" ? insertTablePositionDraw(row.positions) : '')
: '';
}
},
]
The function called is the following:
function insertTablePositionDraw(data){
return '<table class="table table-bordered">' +
'<thead>'+
'<tr>' +
'<th class="text-center">Posición</th>' +
'<th class="text-center">Premio</th>' +
'</tr>' +
'</thead>'+
'<tbody>'+
$.each(data, function(index, item){
'<tr>'+
'<td>'+
data.position;
'</td>'+
'<td>'+
data.pivot.dato;
'</td>'+
'</tr>'
})
'</tbody>'
'</table>'
}
This way I do not create the table correctly, it does not show me the data