Skip to content

Bootstrap 4 not displaying the colour in Print review #40811

Answered by didierpeinke
didierpeinke asked this question in Q&A
Discussion options

You must be logged in to vote

Hi Julien,

Don't worry. I have manage to find a way. What I'm using is

Javascript

var test = $("#example").DataTable();

var v = test.column(4).data().toArray();

for (var i = 0; i < v.length; i++) {
    $(doc.document.body)
        .find("table tbody tr:nth-child(" + (i + 1) + ") td:nth-child(5)")
        .addClass(ColorCode(test.cell(i, 4).data()));
}

Function:

function ColorCode(x) {
    switch (x) {
        case "Test1":
            return "Test1-background-color";
            break;

        case "Test2":
            return Test2-background-color";
            break;
        default:
          return "";
          break;
}

in CSS it is important to use:

/*Remove white background on d…

Replies: 5 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@didierpeinke
Comment options

@julien-deramond
Comment options

@didierpeinke
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@julien-deramond
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by didierpeinke
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants
Converted from issue

This discussion was converted from issue #40810 on September 10, 2024 15:23.