Nested Datatables 1.10.11
Nested Datatables version 1.10.11.
by Karl Nicholas
HTML
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.11/css/jquery.dataTables.min.css">
<script src="https://cdn.datatables.net/1.10.11/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.10.11/js/dataTables.bootstrap.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<table class="table table-striped table-bordered" id="opiniondt">
<thead><tr><th></th><th>Date</th><th>Title</th><th>Document</th></tr></thead>
<tr><td></td><td></td><td></td><td></td></tr>
</table>
CSS
td.details-control {
background: url('http://i.imgur.com/SD7Dz.png') no-repeat center center;
cursor: pointer;
}
tr.shown td.details-control {
background: url('http://i.imgur.com/SD7Dz.png') no-repeat center center;
}
JavaScript
var opinions = [{"id":47,"name":"E061140","fileName":null,"disposition":null,"summary":null,"title":"Marr. of Eustice","opinionDate":"2015-12-10"},{"id":48,"name":"C070296M","fileName":null,"disposition":null,"summary":null,"title":"P. v. Nilsson","opinionDate":"2015-12-10"},{"id":50,"name":"S209643","fileName":null,"disposition":null,"summary":null,"title":"P. v. Stevens","opinionDate":"2015-12-10"}];
var sections = [{"code":"code of civil procedure","sectionNumber":{"position":-1,"sectionNumber":"177.5"},"refCount":2,"section":{"part":"Chapter","partNumber":"4","title":"Incidental Powers and Duties of Judicial Officers","codeRange":{"sNumber":{"position":168,"sectionNumber":"177"},"eNumber":{"position":171,"sectionNumber":"179"}},"depth":3}},{"code":"code of civil procedure","sectionNumber":{"position":-1,"sectionNumber":"580"},"refCount":16,"section":{"part":"Chapter","partNumber":"1","title":"Judgment in General","codeRange":{"sNumber":{"position":862,"sectionNumber":"577"},"eNumber":{"position":879,"sectionNumber":"582.5"}},"depth":3}}];
function format ( table_id ) {
return '<table class="table table-striped" id="opiniondt_'+table_id+'">'+
'<thead><tr><th>References</th><th>Section</th><th>Statute Titles</th></tr></thead>'+
'<tr>'+
'<td>Full name:</td>'+
'<td>Extension number:</td>'+
'<td>Extra info:</td>'+
'</tr>'+
'<tr>'+
'<td>Full name:</td>'+
'<td>Extension number:</td>'+
'<td>Extra info:</td>'+
'</tr>'+
'</table>';
}
var iTableCounter=1;
var oInnerTable;
$(document).ready(function() {
TableHtml = $('#opiniondt').html();
var table = $('#opiniondt').DataTable( {
paging: false,
searching: false,
info: false,
rowId: 'id',
data: opinions,
columns:[
{ className: 'details-control',
orderable: false,
data: null,
defaultContent: '' },
{ data:'opinionDate'},
...