|
@@ -28,6 +28,30 @@ function initializeDataTable() {
|
|
|
var dataTablesButtonsConfig = JSON.parse(document.getElementById('datatable-config').dataset.datatableButtonsConfig);
|
|
var dataTablesButtonsConfig = JSON.parse(document.getElementById('datatable-config').dataset.datatableButtonsConfig);
|
|
|
var dataTablesColumnDefsConfig = JSON.parse(document.getElementById('datatable-config').dataset.datatableColumnDefsConfig);
|
|
var dataTablesColumnDefsConfig = JSON.parse(document.getElementById('datatable-config').dataset.datatableColumnDefsConfig);
|
|
|
|
|
|
|
|
|
|
+ //Strip out HTML from headers when exporting
|
|
|
|
|
+ dataTablesButtonsConfig.forEach(function(buttonConfig){
|
|
|
|
|
+ buttonConfig.exportOptions = buttonConfig.exportOptions || {};
|
|
|
|
|
+ for(let key in buttonConfig)
|
|
|
|
|
+ {
|
|
|
|
|
+ if(key === "exportOptions")
|
|
|
|
|
+ {
|
|
|
|
|
+ console.log('Export Check');
|
|
|
|
|
+ buttonConfig.exportOptions.format = {
|
|
|
|
|
+ header: function (data){
|
|
|
|
|
+ const tempDiv = document.createElement('div');
|
|
|
|
|
+ tempDiv.innerHTML = data;
|
|
|
|
|
+
|
|
|
|
|
+ // Remove all <select> elements
|
|
|
|
|
+ tempDiv.querySelectorAll('select').forEach(el => el.remove());
|
|
|
|
|
+
|
|
|
|
|
+ return tempDiv.textContent.trim().replace(/\s+/g, ' ');
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
|
|
|
//Set up any action columns
|
|
//Set up any action columns
|
|
|
function doActionButton(url, id)
|
|
function doActionButton(url, id)
|