I'm using jQuery datatable with Ajax. Server with Laravel returns a JSON with the format:
{
"draw":0,
"recordsTotal":201
,"recordsFiltered":201,
"data":[{
"id":"1",
"numsocio":"1",
"identificacion":"9999999999",
"nombre":"Anna,
"apellidos":"Desclau", ........ etc
And I want to build a table like this (3 rows sample)
I'm using
$(document).ready(function () {
$('#socios_datatable').DataTable({
ajax: '{{ route('socios.datatable') }}',
columns: [
{ data: 'foto' },
{ data: 'nombre' },
{ ... }
]
});
});
And I've been testing with the info post in http://www.cscc.edu/_resources/app-data/datatables/examples/api/row_details.html but I don't get it to make it work. How to build easily a row with 2 subrows? I see that jQuery datatables is perfect for one row with several columns but for more complex rows is difficult.
May anybody help me?

$('#example tbody').on('click', 'td.details-control', function () { var tr = $(this).closest('tr'); var row = table.row( tr ); if ( row.child.isShown() ) { // This row is already open - close it row.child.hide(); tr.removeClass('shown'); } else { // Open this row row.child( format(row.data()) ).show(); tr.addClass('shown'); } } );