KoolReport's Forum

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

Displaying row labels on a Table? #2907

Open Richb201 opened this topic on on Dec 17, 2022 - 7 comments

Richb201 commented on Dec 17, 2022

I have a table and the column labels are good. It has 3 rows and I'd like to label each row. Any example of row labels?

Richb201 commented on Dec 18, 2022

Here is the table. I'd like to label the two rows activity method and BC method. How can I do this?

I'd also like to put a thick black frame around this table. How can I do this? And how can I make the background of the rows entirely white instead of two tone?

Richb201 commented on Dec 18, 2022

Here is the code for the above table.

<?php
Table::create(array(
"dataStore"=>$this->dataStore("results")->filter("taxyear","=",$_SESSION['last_TY']),
"showHeader"=>true,
    "headers"=>array(
        array(
            "Final Results"=>array("colSpan"=>5),
        )
    ),
"showFooter"=>true,
"columns"=>array(

"wages"=>array(
"cssStyle"=>"text-align:left",
"prefix"=>"$",
"footer"=>"avg",
"footerText"=>"<b>resulting avg Wages:</b> @value"
),

"supplies"=>array(
"cssStyle"=>"text-align:left",
"prefix"=>"$",
"footer"=>"avg",
"footerText"=>"<b>resulting avg Supplies:</b> @value"
),

"computer_rental"=>array(
"cssStyle"=>"text-align:left",
"prefix"=>"$",
"footer"=>"avg",
"footerText"=>"<b>resulting avg Rental:</b> @value"
),

"contract_research"=>array(
"cssStyle"=>"text-align:left",
"prefix"=>"$",
"footer"=>"avg",
"footerText"=>"<b>resulting avg Contracts:</b> @value"
),

"total_QREs"=>array(
"cssStyle"=>"text-align:left",
"prefix"=>"$",
"footer"=>"avg",
"footerText"=>"<b>resulting avg Qualified QREs:</b> @value"
    ),

),
"cssClass"=>array(
"table"=>"table-bordered table-striped table-hover","tf"=>"footerCss"
)
));
?>
Sebastian Morales commented on Dec 19, 2022

You can assign css classes for your Table's elements. Then add css rules that you want for each element, such as table's outside border:

https://www.koolreport.com/docs/koolphp/table/#table-settings-cssclass-options

As for striped rows, just remove "table-striped" from your cssClass' table.

Richb201 commented on Dec 19, 2022

OK. I added another column that I show in this image which serves as the row title. I'd like to change the text of these two it and also give it a red background color.

Richb201 commented on Dec 19, 2022

I know I want to set the background for the leftmost column to to red with white letters. How? I see to use "td"=>"cell-css-class". But I am perplexed by your documentation. I see CssClass options but those links (if they are links) don't work in my browser. How can I set that first column to red background with white CAPITAL letters? I see th, tr, tf. How about tc for column?

Sebastian Morales commented on Dec 20, 2022

If you want more flexibility when setting td's css class there's the function form like this:

//Use function
Table::create(array(
    "cssClass"=>array(
        "table"=>"table table-bordered",
        "tr"=>function($row){
            return "row-css-class";
        },
        "th"=>function($columnName){
            return "header-css-class";
        },
        "td"=>function($row,$columnName){
            return "cell-css-class";
        },
        "tf"=>function($columnName){
            return "footer-cell-css-class";
        }
    )
))

If there's any difficulty let us know. Rgds,

Richb201 commented on Dec 20, 2022

Sebastian, I am not sure how your response will help me turn the background of the type column red? Can you elaborate?

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

None