JS: Datatables многострочное сообщение - PullRequest
0 голосов
/ 10 ноября 2018

Здравствуйте, ребята, я ищу js-код, куда я могу добавить несколько строк сообщения при экспорте в PDF

$(document).ready(function() {
var printCounter = 0;

// Append a caption to the table before the DataTables initialisation
$('#example1').DataTable( {
    dom: 'Bfrtip',
    buttons: [
        'copy',
        {
            extend: 'pdf',
            footer:true,
            message:'this is line1',
            title: 'This is title',
            orientation: 'landscape',
            messageTop: 'The information in this table is copyright to Sirius Cybernetics Corp.',


        },
        {
            extend: 'pdf',

            messageBottom: null
        },
        {
            extend: 'print',
            messageTop: function () {
                printCounter++;

                if ( printCounter === 1 ) {
                    return 'This is the first time you have printed this document.';
                }
                else {
                    return 'You have printed this document '+printCounter+' times';
                }
            },
            messageBottom: null
        }
    ]
} );

});

Я хочу знать, как я могудобавить message: в pdf файл?

1 Ответ

0 голосов
/ 10 ноября 2018

Как вы можете видеть здесь https://datatables.net/reference/button/pdf message: устарело. Используйте messageBottom: или messageTop:.

Несколько строк легко. Просто используйте \r\n как в

messageBottom: function() {
    return '\r\n this is the first line preceeded by an empty line' +
           '\r\n this is the second line' +
           '\r\n \r\n this is the third line preceeded by an empty line';
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...