<script type="text/javascript">
var information = <?php echo json_encode($data) ?>;
console.log(JSON.stringify(information[0]));
$(document).ready(function () {
$('#my-table').dataTable({
data: information,
columns: [
{ data: 'EmpName' },
{ data: 'NumSales' },
{
data: 'TotalSales',
render: $.fn.dataTable.render.number(",", ".", 2, '$'),
},
{
data: 'LMonthSales',
render: $.fn.dataTable.render.number(",", ".", 2, '$'),
},
{
data: '2MonthSales',
render: $.fn.dataTable.render.number(",", ".", 2, '$'),
},
{
data: '3MonthSales',
render: $.fn.dataTable.render.number(",", ".", 2, '$'),
},
{
data: '4MonthSales',
render: $.fn.dataTable.render.number(",", ".", 2, '$'),
},
{
data: '5MonthSales',
render: $.fn.dataTable.render.number(",", ".", 2, '$'),
},
{
data: '6MonthSales',
render: $.fn.dataTable.render.number(",", ".", 2, '$'),
}
],
dom: 'Bfrtip',
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
]
});
});
</script>