Skip to content

Commit

Permalink
Merge branch 'trunk' into pt_188794535
Browse files Browse the repository at this point in the history
  • Loading branch information
saikumar9 authored Jan 24, 2025
2 parents b310370 + 9a64599 commit 0b521c3
Show file tree
Hide file tree
Showing 2 changed files with 123 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,66 @@
}
},
"columns": filteredColumnList,
"buttons": [
{
extend: 'copy',
exportOptions: {
format: {
header: function(str) { return $("<div>" + str + "</div>").text().trim(); },
body: function(data, row, column, node) {
if (typeof data === 'string' && data.includes('<')) {
return $(node).text().trim();
}
return data;
}
},
columns: ':not(.col-actions)'
}
},
{
extend: 'excel',
exportOptions: {
format: {
header: function(str) { return $("<div>" + str + "</div>").text().trim(); },
body: function(data, row, column, node) {
if (typeof data === 'string' && data.includes('<')) {
return $(node).text().trim();
}
return data;
}
},
columns: ':not(.col-actions)'
}
},
{
extend: 'csv',
exportOptions: {
format: {
header: function(str) { return $("<div>" + str + "</div>").text().trim(); },
body: function(data, row, column, node) {
if (typeof data === 'string' && data.includes('<')) {
return $(node).text().trim();
}
return data;
}
},
columns: ':not(.col-actions)'
}
},
{
extend: 'print',
exportOptions: {
columns: ':not(.col-actions)'
},
customize: function(win) {
// Convert any HTML in the print view to plain text
$(win.document.body).find('table').find('td,th').each(function() {
var $cell = $(this);
$cell.text($cell.text().trim());
});
}
}
],
'dom': "<'d-flex align-items-center w-100 justify-content-between mb-4'" +
"Bf" +
">" +
Expand Down Expand Up @@ -154,6 +214,66 @@
}
},
"columns": filteredColumnList,
"buttons": [
{
extend: 'copy',
exportOptions: {
format: {
header: function(str) { return $("<div>" + str + "</div>").text().trim(); },
body: function(data, row, column, node) {
if (typeof data === 'string' && data.includes('<')) {
return $(node).text().trim();
}
return data;
}
},
columns: ':not(.col-actions)'
}
},
{
extend: 'excel',
exportOptions: {
format: {
header: function(str) { return $("<div>" + str + "</div>").text().trim(); },
body: function(data, row, column, node) {
if (typeof data === 'string' && data.includes('<')) {
return $(node).text().trim();
}
return data;
}
},
columns: ':not(.col-actions)'
}
},
{
extend: 'csv',
exportOptions: {
format: {
header: function(str) { return $("<div>" + str + "</div>").text().trim(); },
body: function(data, row, column, node) {
if (typeof data === 'string' && data.includes('<')) {
return $(node).text().trim();
}
return data;
}
},
columns: ':not(.col-actions)'
}
},
{
extend: 'print',
exportOptions: {
columns: ':not(.col-actions)'
},
customize: function(win) {
// Convert any HTML in the print view to plain text
$(win.document.body).find('table').find('td,th').each(function() {
var $cell = $(this);
$cell.text($cell.text().trim());
});
}
}
],
'dom': "<'row'" +
"<'col-sm-7 col-md-7'B><'col-sm-5 col-md-5'f>" +
">" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ DataTable.ext.buttons.print = {
action: function ( e, dt, button, config ) {
// Function to remove href tags
function removeHrefTags(data) {
if (!data || typeof data !== 'string') {
return data || '';
}
return data.replace(/<a\b[^>]*>(.*?)<\/a>/gi, '$1');
}

Expand Down

0 comments on commit 0b521c3

Please sign in to comment.