JavaScript
var dataSet = [
[ "AMMO", "Meeting Minutes", "[email protected]", "02/10/2020", "Yes", "Example Notes" ],
[ "AMMO", "Monthly Status Report", "[email protected]", "02/10/2020", "Yes", "Example Notes" ],
[ "Dar-Q", "Meeting Minutes", "[email protected]", "02/10/2020", "Yes", "Example Notes" ],
[ "Dar-Q", "Monthly Status Report", "[email protected]", "02/10/2020", "Yes", "Example Notes" ],
[ "WTBn", "Meeting Minutes", "[email protected]", "02/10/2020", "Yes", "Example Notes" ],
[ "WTBn", "Monthly Status Report", "[email protected]", "02/10/2020", "Yes", "Example Notes" ],
];
$(document).ready(function() {
var table = $('#myTable').DataTable( {
data: dataSet,
columns: [
{ title: "Program" },
{ title: "Deliverable" },
{ title: "To" },
{ title: "Date" },
{ title: "Approved" },
{ title: "Notes" }
],
dom: "<'row'<'col-sm-12 col-md-10'f><'col-sm-12 col-md-2'B>>" +
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",
buttons: [{
extend: 'collection',
className: "btn-dark",
text: 'Export',
buttons:
[{
extend: "excel", className: "btn-dark"
},
{
extend: "pdf", className: "btn-dark"
},
{
extend: "print", className: "btn-dark"
},
{
text: 'Update Table',
action: function (e, dt, node, config){
(alert( 'Button activated' );
}
}
],
}],
order: [[0, 'asc'], [1, 'asc'] ],
rowGroup: {
dataSrc: [
'Program',
'Deliverable'
],
startRender: function (rows,group,level){
var all;
if (level === 0) {
top = group;
all = group;
} else if (level === 1) {
parent = top + group;
all = parent;
// if parent collapsed, nothing to do
if...