Excel not breaking.
Excel not breaking.
cicjr
Posts: 7Questions: 2Answers: 0
"buttons": {
buttons: [
{ extend: 'csv',
title: exportFileName,
exportOptions: {
columns: ':visible', stripHtml: true,
modifier: {
// DataTables core
search: 'applied',
order: 'current',
page: 'all'
}
},
format: {
body: function ( data, column, row, node ) {
// replace <BR> to "/"
return column === 11 ?
data.replace( /<br\s*\/?>/ig, "\n" ) : data;
return column === 12 ?
data.replace( /<br\s*\/?>/ig, "\n" ) : data;
return column === 13 ?
data.replace( /<br\s*\/?>/ig, "\n" ) : data;
return column === 14 ?
data.replace( /<br\s*\/?>/ig, "\n" ) : data;
return column === 15 ?
data.replace( /<br\s*\/?>/ig, "\n" ) : data;
This discussion has been closed.
Answers
Hi @cicjr,
did you already try:
data.replace(/<br.*?>/gmi, '\u2028')
Thank you F12Magic.
With that:
columns: ':visible', stripHtml: true,
modifier: {
// DataTables core
search: 'applied', // 'none', 'applied', 'removed'
order: 'current', // 'current', 'applied', 'index', 'original'
page: 'all' // 'all', 'current'
}
I won't be able replace it. What I need is to break the string and add "," after 5 digits.
Let's say:
1000130003
It should export as
10001, 30003
Thank you again !
Could you clarify your question, or provide a working example?
You want a csv export and split the values of certain columns. Is it that what you want?