Opa,
In a same cell in the datatable there may be several rows, and the buttons
function to export from the datatable does not recognize the <Br>
tag, I am trying to use columns
and render
this way, just for test , where it should change ,
to <br>
. The datatable appears, but the buttons do not.
$(document).ready(function() {
var table = $('#example').DataTable( {
///Se adicionar botões exportar não aparecem
columns: [
null,
null,
null,
null,
null,
{
render: function(data, type, row){
return data.split(", ").join("<br/>");
}
}
],
///Se adicionar botões exportar não aparecem
lengthChange: false,
buttons: [
{
extend: 'copy',
text: 'Copiar'
},
{
extend: 'print',
text: 'Imprimir',
message: '<?php echo $TextoArquivoExport;?>',
},
{
extend: 'excelHtml5',
title: '<?php echo $NomeArquivoExport;?>'
},
{
extend: 'pdfHtml5',
orientation: 'landscape',
pageSize: 'LEGAL',
fieldSeparator: '\t',
message: '<?php echo $TextoArquivoExport;?>',
title: '<?php echo $NomeArquivoExport;?>',
exportOptions: {
stripNewlines: false
}
},
{
extend: 'colvis',
text: 'Exibir/Ocultar Coluna'
}
],
language: {
buttons: {
copyTitle: 'Informações do relatório copiadas',
copyKeys: 'Foram copiados <i>ctrl</i> ou <i>\u2318</i> + <i>C</i> registros. <br><br>Por favor, pressione o botão ESC para sair.',
copySuccess: {
_: '%d registros copiados',
1: '1 linha copiada'
}
}
}
} );
The goal in question is to replace ,
with <br>
and to have the line break.
Based on columns
and render
:
link
Possible solution removed from: link