Row details can be done easier
Row details can be done easier
aschippers
Posts: 22Questions: 8Answers: 3
Hallo Allan,
I used the row details example for giving more details on my data.
https://datatables.net/examples/api/row_details.html
This can be done a little bit easier, with the advantage of passing through less initial data to datatables
in ruby on rails is this referring to the "show" section of a controller. for rendering a show pages without layout in rails, you just do render :show, :layout => false
function virtual_aliases_show ( d ) {
return '<div id="row_'+d.id+'"></div>';
};
function virtual_aliases_load_show (d) {
$('#row_' + d.id).load('/virtual_aliases/'+d.id+'.html');
};
$('#virtual_aliases tbody').on('click', 'td.details-control', function () {
var tr = $(this).closest('tr');
var row = virtual_aliases.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( virtual_aliases_show(row.data()) ).show();
virtual_aliases_load_show(row.data());
tr.addClass('shown');
}
} );
This discussion has been closed.