I have an existing module that shows data inside a table (using DataTables (jQuery)) and the end user has asked for them to be able to print the data.
$('.js-dataTable-full-agedDebt').DataTable({
ajax: {
url: 'inc/ajax/tables/payable/aged-debt.php',
type: "post",
data: function(d){
d.depot = Depot;
d.group = Group;
}
},
dom: 'Bfrtip',
pagingType: "full_numbers",
buttons: [
'print'
],
order: [1., 'asc'],
"deferRender": true,
scrollY: "500px",
paging: false,
columns: [
{"data": "Account"},
{"data": "Term"},
{"data": "Credit"},
{"data": "Total"},
{"data": "Amount"},
{"data": "Month1"},
{"data": "Month2"},
{"data": "Month3"},
{"data": "Month4"},
{"data": "Month5"},
{"data": "Action"},
{"data": "balanceMonthRemit"},
{"data": "balanceMonth"},
{"data": "balanceMonthMinusOne"},
{"data": "balanceMonthMinusTwo"},
{"data": "balanceMonthMinusThree"},
{"data": "balanceOlder"},
],
"columnDefs": [
{"visible": false, "targets": [11, 12, 13, 14, 15, 16]},
{"orderData": [ 11 ], "targets": 4 },
{"orderData": [ 12 ], "targets": 5 },
{"orderData": [ 13 ], "targets": 6 },
{"orderData": [ 14 ], "targets": 7 },
{"orderData": [ 15 ], "targets": 8 },
{"orderData": [ 16 ], "targets": 9 },
]
}
This is fine in normal circumstances, however, this table doesn't have default values. The values in 90% of the cells are anchor tags with a popOver (which shows a smaller datatable showing the calculation).
<a onmouseover="popupDataActivityTotal("CN000141-N")" onmouseout="popupDataActivityTotalClose("CN000141-N")" class="popOver" id="activityTotalCN000141-N" style="color:#3f9ce8;" data-toggle="popover" data-html="true" title="" data-placement="bottom" data-content="
<table class="table table-bordered table-striped">
<thead>
<th class="pl-15 pr-15">Doc Type</th>
<th class="pl-15 pr-15">Doc Num</th>
<th class="pl-15 pr-15">Doc Date</th>
<th class="pl-15 pr-15">Due Date</th>
<th class="pl-15 pr-15">Open Amount</th>
</thead>
<tbody>
<tr>
<td class="pl-15 pr-15">Invoice</td>
<td class="pl-15 pr-15">600054871</td>
<td class="pl-15 pr-15">18th June 2021</td>
<td class="pl-15 pr-15">18th June 2021</td>
<td class="pl-15 pr-15">£48.89</td>
</tr>
<tr>
<td class="pl-15 pr-15">Invoice</td>
<td class="pl-15 pr-15">600055336</td>
<td class="pl-15 pr-15">29th June 2021</td>
<td class="pl-15 pr-15">29th June 2021</td>
<td class="pl-15 pr-15">£601.32</td>
</tr>
<tr>
<td class="pl-15 pr-15">Invoice</td>
<td class="pl-15 pr-15">600055918</td>
<td class="pl-15 pr-15">13th July 2021</td>
<td class="pl-15 pr-15">13th July 2021</td>
<td class="pl-15 pr-15">£72.00</td>
</tr></tbody></table>
" data-original-title="Account Activity Total">
722.21
</a>
This results in the below
I need these fields to show only the innerHTML/value so when I click print, it doesnt show up like this:

