I have this example taken from
Datatables
which I require, although this example when pressing a certain button shows a little more information than what is in that row.
But in my case I require that with the id of that row make a shipment by ajax and in the .done
make a cycle so that it shows me all the qualifications that a student has.
DATABLES CODE
// Add event listener for opening and closing details
$('#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');
}
} );
function format ( d ) {
// 'd' is the original data object for the row
return '<table cellpadding="5" cellspacing="0" border="0" style="padding-left:50px;">'+
'<tr>'+
'<td>Full name:</td>'+
'<td>'+d.name+'</td>'+
'</tr>'+
'<tr>'+
'<td>Extension number:</td>'+
'<td>'+d.extn+'</td>'+
'</tr>'+
'<tr>'+
'<td>Extra info:</td>'+
'<td>And any further details here (images etc)...</td>'+
'</tr>'+
'</table>';
}
The function format(d)
receives the data and returns that data in a view created a small table that in a few words would be the child.rows()
If in that function I take that data and implement an ajax the function will never show me the operations that I have performed in the .done that is necessarily a for cycle, but it will show me everything that return
out of the ajax.
I hope to have made myself understood and that if there is the possibility of doing a ajax
and make a for
for the received data that are the ratings per student would be of great help.