Print Button Columns Words Stacking

Print Button Columns Words Stacking

cwhaleycwhaley Posts: 2Questions: 1Answers: 0

I'm using the DataTables Print Button and I am having trouble getting both of the columns to print the same. I use the same button setup for both grids that I print, but one grid will leave the Column header as-is, and the other will stack them.

For example, instead of the column saying "First Middle," it will be "First\nMiddle."

buttons: [
    {
        extend: 'print',
        className: 'printButtonDetailOnly',
        exportOptions: {
            columns: ':visible',
        },
        title: 'I stack, sad face'
        customize: function (win) {
            $(win.document.body)
        .css('font-size', '18pt');

            $(win.document.body).find('table')
                .addClass('compact')
                .css('font-size', 'inherit');
        },
    }
]

which leaves me with a stacked column

That, compared to the other print button:

buttons: [
    {
        extend: 'print',
        exportOptions: {
            columns: ':visible'
        },
        title: 'I do not stack! Yay!',
        customize: function (win) {
            $(win.document.body)
        .css('font-size', '18pt');

            $(win.document.body).find('table')
                .addClass('compact')
                .css('font-size', 'inherit');
        },
    }
]

which provides an un-stacked column

I've been kicking this around for a few days, looking into all the properties for the print button, but nothing seems to control this.un-stacked column

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,310Questions: 26Answers: 4,948
    Answer ✓

    Without seeing how you defined the tables my guess is one table has the class of "nowrap" and the other does not.

    Kevin

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    Also, we have no idea what your 'printButtonDetailOnly' class is doing.

  • cwhaleycwhaley Posts: 2Questions: 1Answers: 0

    Thanks Kevin. That's exactly what it was.

This discussion has been closed.