Skip to content

Commit e613ade

Browse files
committed
Fix: New line wasn't being used between body and footer for CSV and Copy inline and exports
Fix: `footer` could show undefined if the title `span` was replaced https://datatables.net/forums/discussion/78342
1 parent f11b477 commit e613ade

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

js/buttons.html5.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ var _exportData = function (dt, config) {
333333
}
334334

335335
return {
336-
str: header + body.join(newLine) + footer,
336+
str: header + body.join(newLine) + newLine + footer,
337337
rows: body.length
338338
};
339339
};

js/dataTables.buttons.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2584,11 +2584,17 @@ var _exportData = function (dt, inOpts) {
25842584
.indexes()
25852585
.map(function (idx) {
25862586
var el = dt.column(idx).footer();
2587-
return config.format.footer(
2588-
el ? $('.dt-column-title', el).html() : '',
2589-
idx,
2590-
el
2591-
);
2587+
var val = '';
2588+
2589+
if (el) {
2590+
var inner = $('.dt-column-title', el);
2591+
2592+
val = inner.length
2593+
? inner.html()
2594+
: $(el).html();
2595+
}
2596+
2597+
return config.format.footer(val, idx, el);
25922598
})
25932599
.toArray()
25942600
: null;

0 commit comments

Comments
 (0)