DataTables::create(array(
"name" => "MyTable1",
"onReady" => "initCollapse",
"dataStore" => $this->dataStore('sales_by_customer'),
"themeBase" => "bs4", // Reference Bootstrap 4 theme
"cssClass" => array("table" => "table table-bordered table-hover table-striped"),
"showFooter" => false,
"columns" => array(
"number22" => array("label" => "Invoice Number", "class" => "text-center"),
"date2" => array("label" => "Invoice Date", "class" => "text-center"),
"number2" => array("label" => "Total Excl VAT", "class" => "text-center"),
"number20" => array("label" => "Invoice total", "class" => "text-center", "table-striped", "formatValue" => function($value) {
return '£' . number_format($value, 2, '.', ',');
} ),
),
"plugins" => array("Buttons", "FixedColumns", "FixedHeader", "KeyTable", "Responsive", "RowReorder", "Scroller", "SearchPanes", "RowGroup"),
"buttons" => array(
array(
"extend" => "pdfHtml5",
"orientation" => "landscape",
"pageSize" => "A4",
"title" => "Invoice Report"
),
"copy", "csv", "excel", "print", "colvis"
),
"options" => array(
"paging" => true,
"pageLength" => 200,
"searching" => true,
"dom" => 'Bfrtip',
"buttons" => array("copy", "csv", "excel", "pdf", "print", "colvis"),
),
"clientRowGroup" => array(
"number22" => array(
"calculate" => array(
"number20" => array("sum", "number20")
),
"top" => "<td colspan='3'>{expandCollapseIcon} Invoice No #{number22}",
"bottom" => "<td colspan='3'>Total: £{number20}</td>",
"groupCollapse" => false,
)
),
! (https://cdn.koolreport.com/assets/images/editor/c5/image64eefe2eb868b.png)