Header Settings

How to configure header of Table

Off header display
John 26 50,000
Marry 29 60,000
Peter 34 100,000
Donald 28 80,000
Header Grouping
Basic Information Other Information
nameageincome
John 26 50,000
Marry 29 60,000
Peter 34 100,000
Donald 28 80,000

Table widget allows you to customize the header, by default header will show but you can turn it off if you want by setting "showHeader"=>false. Secondly, you can setup multi-level header grouping for your table.

<?php
require_once "MyReport.php";

$report = new MyReport;
$report->run()->render();
<?php
//Step 1: Load KoolReport
require_once "../../../load.koolreport.php";

//Step 2: Creating Report class
class MyReport extends \koolreport\KoolReport
{
    protected function settings()
    {
        return array(
            "dataSources"=>array(
                "data"=>array(
                    "class"=>'\koolreport\datasources\ArrayDataSource',
                    "dataFormat"=>"table",
                    "data"=>array(
                        array("name","age","income"),
                        array("John",26,50000),
                        array("Marry",29,60000),
                        array("Peter",34,100000),
                        array("Donald",28,80000),
                    )
                )
            )
        );
    }
    protected function setup()
    {
        $this->src("data")
        ->pipe($this->dataStore("data"));
    }    
}
<?php
    use \koolreport\widgets\koolphp\Table;
?>
<div class="report-content">
    <div class="text-center">
        <h1>Header Settings</h1>
        <p class="lead">How to configure header of Table</p>
    </div>
    
    <h5 class="text-center">Off header display</h5>
    <?php
    Table::create(array(
        "dataSource"=>$this->dataStore('data'),
        "showHeader"=>false
    ));
    ?>
    <h5 class="text-center">Header Grouping</h5>
    <?php
    Table::create(array(
        "dataSource"=>$this->dataStore('data'),
        "headers"=>array(
            array(
                "Basic Information"=>array("colSpan"=>1),
                "Other Information"=>array("colSpan"=>2),
            )
        ),
        "cssClass"=>array(
            "table"=>"table-bordered table-striped table-hover"
        )
    ));
    ?>

</div>

What People Are Saying

"KoolReport helps me very much in creating data report for my corporate! Keep up your good work!"
-- Alain Melsens

"The first use of your product. I was impressed by its easiness and powerfulness. This product is a great and amazing."
-- Dr. Lew Choy Onn

"Fantastic framework for reporting!"
-- Greg Schneider

Download KoolReport Get KoolReport Pro