KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Line Background Color #1099

Closed Julio Albuquerque opened this topic on on Sep 24, 2019 - 3 comments

Julio Albuquerque commented on Sep 24, 2019

I was using Table, but I had to leave the header fixed. I saw that the DataGrid package does this, so I bought this package. With Table I set the background color of the line with the code below. That is, depending on the value of the column I want the row to change the background color. How to do this in DataGrid?

    DataTables::create(array(
        "dataSource" => $this->dataStore("orcamento"),
        "options" => array(
            "fixedHeader" => true,
        ),
        "columns" => $this->campos,
        "cssClass" => array(
            "table" => "cell-border",
            "tr" => function ($row) {
                if ($row['ordem'] == 7) {
                    return "DespesasDiaCss";
                } else if ($row['ordem'] == 8) {
                    return "LiquidoCss";
                } else if ($row['is_quebra'] == 1) {
                    return "QuebraTituloCss";
                } else if ($row['is_total_geral'] == 1) {
                    return "QuebraTotalGeralCss";
                } else if ($row['is_total_quebra'] == 1) {
                    return "QuebraTotalCss";
                } else if ($row['is_empresa'] == 1) {
                    return "isEmpresaCss";
                }
            }
        )
    ));
Julio Albuquerque commented on Sep 24, 2019

I noticed it works this way, the lines get the classes correctly. When loading the page the lines get the background color as the function dictates, but immediately it looks like a refresh happens and all is lost.

KoolReport commented on Sep 25, 2019

In your custom css class definition, you add !important for example:

    .QuebraTituloCss {
        background-color: #B7B7B7 !important;
    }

Let us know if it works.

Julio Albuquerque commented on Sep 25, 2019

Thank you! Finally worked perfectly!

Taking advantage, if possible, how do I get information from the number of footer records?

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed

DataGrid