2
Opa,
In the same cell of the datatable there can be several lines, and the function buttonsto export from datatable does not recognize tag <Br>, I’m trying to use the columns and the render this way, only for testing, where it should exchange the , for <br>. Datatable appears, but not buttons.
$(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 objective in question is to replace the , for <br>and there’s a line break.
Based on columnsand in the render:
https://datatables.net/reference/option/columns.render
Possible solution taken from: https://stackoverflow.com/questions/32791577/how-can-i-implement-new-line-in-a-column-datatables
Without success buddy, the same occurs, when editing what you reported, the export buttons do not appear. I need exactly that they appear and in the export the line breaks also work. Hug
– sNniffer