Child Rows
Child Rows
kombat
Posts: 15Questions: 5Answers: 0
This one has me stumped all afternoon. I'm following the example exactly. It always falls into the else, and the child never display. I'm sure I'm missing something simple, but like I said, I've been looking at this all afternoon and getting no where. The datatable itself is working fine. Just can't get the child row thing to work.
Here's the datatable init:
dtTable = $('#resultTable').DataTable({
//]]>
<cccjj:jQueryDataTablesLanguageOptions />,
//<![CDATA[
'processing': true,
'serverSide': true,
'pagingType': 'full_numbers',
'autoWidth': false,
'columnDefs': getColumnDefs(),
'dom': '<"dataTables-row"<"dataTables-half-left"l><"dataTables-half-right"f>r><"dataTables_scroll"t><"dataTables-row"<"dataTables-half-left"i><"dataTables-half-right"p>>',
'ajax': function(dataToSend, callback, tableSettings) {
$.getJSON(url, dataToSend, function(data) {
callback(data);
// Doing something here
});
}
});
And the detail event function:
e.preventDefault();
var tr = $(this).closest('tr');
var row = dtTable.row(tr);
if(row.child.isShown()) {
row.child.hide();
tr.removeClass('shown');
} else {
row.child('<table><tr><td>Karl</td></tr></table>').show();
tr.addClass('shown');
}
This discussion has been closed.
Answers
deleted comment