Minimum Settings

Minimum settings to get KoolPHP Table working

nameageincome
John 26 50,000
Marry 29 60,000
Peter 34 100,000
Donald 28 80,000

Getting started with Table is very easy! All you need to do is to provide "dataSource" for table, for example:

<?php
Table::create(array(
    "dataSource"=>$this->dataStore('data')
));
?>

Use SQL Query

Table can receive direct query, for example:

<?php 
Table::create(array(
    "dataSource"=>$this->src("mysql_database")->query("select * from orders")
));
?>

Use Array

<?php 
Table::create(array(
    "dataSource"=>array(
        array("name","age"),
        array("Peter",35),
        array("John",36)
    )
));
?>

or associate array

<?php 
Table::create(array(
    "dataSource"=>array(
        array("name"=>"Peter","age"=>35),
        array("name"=>"John","age"=>36)
    )
));
?>
<?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>Minimum Settings</h1>
        <p class="lead">Minimum settings to get KoolPHP Table working</p>
    </div>
    <?php
    // $data = array_slice($this->dataStore("data")->data(), 0, 20);
    // echo "<pre>" . var_export($data) . "</pre>";
    $data = array(
        array('name' => 'John', 'age' => 26, 'income' => 50000),
        array('name' => 'Marry', 'age' => 29, 'income' => 60000),
        array('name' => 'Peter', 'age' => 34, 'income' => 100000),
        array('name' => 'Donald', 'age' => 28, 'income' => 80000),
    );
    Table::create(array(
        "dataSource" => $this->dataStore('data')
    ));
    ?>
</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