DataTables' Server-side Footers

By default, DataTables' footer can work with server-side processing

customerName
dollar_sales

This example shows DataTables' footers works with server-side processing by default.

<?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
{
    function settings()
    {
        return array(
            "dataSources" => array(
                "employees"=>array(
                    "connectionString"=>"mysql:host=localhost;dbname=automaker",
                    "username"=>"root",
                    "password"=>"",
                    "charset"=>"utf8"
                ), 
            )
        );
    }
    protected function setup()
    {

    }
}
<?php
    use \koolreport\datagrid\DataTables;
?>
<div class="report-content">
    <div class="text-center">
        <h1>DataTables' Server-side Footers</h1>
        <p class="lead">
            By default, DataTables' footer can work with server-side processing
        </p>
    </div>

    <?php
    DataTables::create(array(
        'name' => 'DataTable1',
        'dataSource' => function() {
            return $this->src("automaker")
            ->query("select * from customer_product_dollarsales2 limit 500");
        },
        'scope' => $this->params,
        "options" => array(
            "searching" => true,
            "paging" => true,
            "colReorder" => true,
            "order" => [],
            "ordering" => true,
            "pageLength" => 10,
        ),
        "columns" => [
            "customerName" => [],
            "dollar_sales" => [
                "prefix" => "$",
                "footer" => "sum",
                "aggregates" => [
                    "totalCount" => ["count", "customerName"],                    
                    "avgSale" => ["avg", "dollar_sales"],
                ],
                "footerText" => "Sum: @value | Avg: @avgSale | Count: @totalCount",
            ],
        ],
        "showFooter"=>true,
        "themeBase"=>"bs4",
        // "fastRender" => true,
        "serverSide"=>true,
        "method"=>'post', //default method = 'get'
        // "searchOnEnter" => true,
        "serverSideInstantSearch" => true,
        "searchMode" => "or"
    ));
    ?>
</div>
customerNameproductNameproductLineorderDateorderDayorderMonthorderYearorderQuarterdollar_sales
Online Diecast Creations Co. 1917 Grand Touring Sedan Vintage Cars 2003-01-06 00:00:00 6 1 2,003 1 4,080
Online Diecast Creations Co. 1911 Ford Town Car Vintage Cars 2003-01-06 00:00:00 6 1 2,003 1 2,755
Online Diecast Creations Co. 1932 Alfa Romeo 8C2300 Spider Sport Vintage Cars 2003-01-06 00:00:00 6 1 2,003 1 1,660
Online Diecast Creations Co. 1936 Mercedes Benz 500k Roadster Vintage Cars 2003-01-06 00:00:00 6 1 2,003 1 1,729
Blauer See Auto, Co. 1932 Model A Ford J-Coupe Vintage Cars 2003-01-09 00:00:00 9 1 2,003 1 2,702
Blauer See Auto, Co. 1928 Mercedes-Benz SSK Vintage Cars 2003-01-09 00:00:00 9 1 2,003 1 4,344
Blauer See Auto, Co. 1939 Chevrolet Deluxe Coupe Vintage Cars 2003-01-09 00:00:00 9 1 2,003 1 1,464
Blauer See Auto, Co. 1938 Cadillac V-16 Presidential Limousine Vintage Cars 2003-01-09 00:00:00 9 1 2,003 1 2,040
Vitachrome Inc. 1937 Lincoln Berline Vintage Cars 2003-01-10 00:00:00 10 1 2,003 1 3,726
Vitachrome Inc. 1936 Mercedes-Benz 500K Special Roadster Vintage Cars 2003-01-10 00:00:00 10 1 2,003 1 1,768

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