jQWidgets Forums

jQuery UI Widgets Forums Grid Colors not printing in grid

This topic contains 4 replies, has 2 voices, and was last updated by  Peter Stoev 7 years, 9 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • Colors not printing in grid #96143

    ydb1md
    Participant

    When I print my JQGrid, colors are not displaying, either in the print preview, on the printed page or when I print to PDF. This applies to the column headers and row background colors.

    Colors not printing in grid #96152

    Peter Stoev
    Keymaster

    Hi ydb1md,

    That’s a setting of the browser’s Print Dialog. it’s not something related to the Grid.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    https://www.jqwidgets.com/

    Colors not printing in grid #96190

    ydb1md
    Participant

    Actually, it is related to the CSS of the grid. Even when “print background colors” in the Print Dialog is selected, the colors aren’t being displayed or printed. I guess I’ll have to solve this on my own and share my solution.

    Colors not printing in grid #96191

    ydb1md
    Participant

    To fix the printing of background colors, I had to add “!important” after each color that I set using the renderer code. Please see my code sample below. Without “!important” colors would not appear in print preview or on the printer output.

    var Statusrenderer = function (row, column, value) {
    if (value == “OK”) {
    OTS = false;
    return ‘<div style=”font-weight: bold; font-size: 24px;background-color: green!important;text-align:center;”>’ + value + ‘</div>’;
    }
    else if (value == “OK-“) {
    OTS = false;
    return ‘<div style=”font-weight: bold; font-size: 24px;background-color: yellow!important;text-align:center;”>’ + value + ‘</div>’;
    }
    else if (value == “OTS”) {
    OTS = true;
    return ‘<div style=”font-weight: bold; font-size: 24px;background-color: red!important;text-align:center;”>’ + value + ‘</div>’;
    }

    Colors not printing in grid #96192

    Peter Stoev
    Keymaster

    Hi ydb1md,

    This is however a custom function which overrides the default cells rendering. This was not mentioned in your post.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    https://www.jqwidgets.com/

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.