Paging

How to set paging in Table

Product NameLineQty In Stock
1969 Harley Davidson Ultimate Chopper Motorcycles 7933
1952 Alpine Renault 1300 Classic Cars 7305
1996 Moto Guzzi 1100i Motorcycles 6625
2003 Harley-Davidson Eagle Drag Bike Motorcycles 5582
1972 Alfa Romeo GTA Classic Cars 3252
1962 LanciaA Delta 16V Classic Cars 6791
1968 Ford Mustang Classic Cars 68
2001 Ferrari Enzo Classic Cars 3619
1958 Setra Bus Trucks and Buses 1579
2002 Suzuki XREO Motorcycles 9997
1969 Corvair Monza Classic Cars 6906
1968 Dodge Charger Classic Cars 9123
1969 Ford Falcon Classic Cars 1049
1970 Plymouth Hemi Cuda Classic Cars 5663
1957 Chevy Pickup Trucks and Buses 6125
1969 Dodge Charger Classic Cars 7323
1940 Ford Pickup Truck Trucks and Buses 2613
1993 Mazda RX-7 Classic Cars 3975
1937 Lincoln Berline Vintage Cars 8693
1936 Mercedes-Benz 500K Special Roadster Vintage Cars 8635
1965 Aston Martin DB5 Classic Cars 9042
1980s Black Hawk Helicopter Planes 5330
1917 Grand Touring Sedan Vintage Cars 2724
1948 Porsche 356-A Roadster Classic Cars 8826
1995 Honda Civic Classic Cars 9772
1998 Chrysler Plymouth Prowler Classic Cars 4724
1911 Ford Town Car Vintage Cars 540
1964 Mercedes Tour Bus Trucks and Buses 8258
1932 Model A Ford J-Coupe Vintage Cars 9354
1926 Ford Fire Engine Trucks and Buses 2018
P-51-D Mustang Planes 992
1936 Harley Davidson El Knucklehead Motorcycles 4357
1928 Mercedes-Benz SSK Vintage Cars 548
1999 Indy 500 Monte Carlo SS Classic Cars 8164
1913 Ford Model T Speedster Vintage Cars 4189
1934 Ford V8 Coupe Vintage Cars 5649
1999 Yamaha Speed Boat Ships 4259
18th Century Vintage Horse Carriage Vintage Cars 5992
1903 Ford Model A Vintage Cars 3913
1992 Ferrari 360 Spider red Classic Cars 8347
1985 Toyota Supra Classic Cars 7733
Collectable Wooden Train Trains 6450
1969 Dodge Super Bee Classic Cars 1917
1917 Maxwell Touring Car Vintage Cars 7913
1976 Ford Gran Torino Classic Cars 9127
1948 Porsche Type 356 Roadster Classic Cars 8990
1957 Vespa GS150 Motorcycles 7689
1941 Chevrolet Special Deluxe Cabriolet Vintage Cars 2378
1970 Triumph Spitfire Classic Cars 5545
1932 Alfa Romeo 8C2300 Spider Sport Vintage Cars 6553
1904 Buick Runabout Vintage Cars 8290
1940s Ford truck Trucks and Buses 3128
1939 Cadillac Limousine Vintage Cars 6645
1957 Corvette Convertible Classic Cars 1249
1957 Ford Thunderbird Classic Cars 3209
1970 Chevy Chevelle SS 454 Classic Cars 1005
1970 Dodge Coronet Classic Cars 4074
1997 BMW R 1100 S Motorcycles 7003
1966 Shelby Cobra 427 S/C Classic Cars 8197
1928 British Royal Navy Airplane Planes 3627
1939 Chevrolet Deluxe Coupe Vintage Cars 7332
1960 BSA Gold Star DBD34 Motorcycles 15
18th century schooner Ships 1898
1938 Cadillac V-16 Presidential Limousine Vintage Cars 2847
1962 Volkswagen Microbus Trucks and Buses 2327
1982 Ducati 900 Monster Motorcycles 6840
1949 Jaguar XK 120 Classic Cars 2350
1958 Chevy Corvette Limited Edition Classic Cars 2542
1900s Vintage Bi-Plane Planes 5942
1952 Citroen-15CV Classic Cars 1452
1982 Lamborghini Diablo Classic Cars 7723
1912 Ford Model T Delivery Wagon Vintage Cars 9173
1969 Chevrolet Camaro Z28 Classic Cars 4695
1971 Alpine Renault 1600s Classic Cars 7995
1937 Horch 930V Limousine Vintage Cars 2902
2002 Chevy Corvette Classic Cars 9446
1940 Ford Delivery Sedan Vintage Cars 6621
1956 Porsche 356A Coupe Classic Cars 6600
Corsair F4U ( Bird Cage) Planes 6812
1936 Mercedes Benz 500k Roadster Vintage Cars 2081
1992 Porsche Cayenne Turbo Silver Classic Cars 6582
1936 Chrysler Airflow Vintage Cars 4710
1900s Vintage Tri-Plane Planes 2756
1961 Chevrolet Impala Classic Cars 7869
1980’s GM Manhattan Express Trucks and Buses 5099
1997 BMW F650 ST Motorcycles 178
1982 Ducati 996 R Motorcycles 9241
1954 Greyhound Scenicruiser Trucks and Buses 2874
1950's Chicago Surface Lines Streetcar Trains 8601
1996 Peterbilt 379 Stake Bed with Outrigger Trucks and Buses 814
1928 Ford Phaeton Deluxe Vintage Cars 136
1974 Ducati 350 Mk3 Desmo Motorcycles 3341
1930 Buick Marquette Phaeton Vintage Cars 7062
Diamond T620 Semi-Skirted Tanker Trucks and Buses 1016
1962 City of Detroit Streetcar Trains 1645
2002 Yamaha YZR M1 Motorcycles 600
The Schooner Bluenose Ships 1897
American Airlines: B767-300 Planes 5841
The Mayflower Ships 737
HMS Bounty Ships 3501
America West Airlines B757-200 Planes 9653
The USS Constitution Ship Ships 7083
1982 Camaro Z28 Classic Cars 6934
ATA: B757-300 Planes 7106
F/A 18 Hornet 1/72 Planes 551
The Titanic Ships 1956
The Queen Mary Ships 5088
American Airlines: MD-11S Planes 8820
Boeing X-32A JSF Planes 4857
Pont Yacht Ships 414

If you have a long data, you may organize data in paging with below settings:

Table::create(array(
    ...
    "paging"=>array(
        "pageSize"=>10,
        "pageIndex"=>0,
    ),
))
<?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(
                "long_data"=>array(
                    "class"=>'\koolreport\datasources\CSVDataSource',
                    "fieldSeparator"=>"|",
                    'filePath'=>dirname(__FILE__)."/../../../databases/products.csv",
                )

            )
        );
    }
    protected function setup()
    {
        $this->src("long_data")
        ->pipe($this->dataStore("long_data"));
    }    
}
<?php

use \koolreport\widgets\koolphp\Table;
?>
<div class="report-content">
    <div class="text-center">
        <h1>Paging</h1>
        <p class="lead">How to set paging in Table</p>
    </div>
    <?php
    // $data = array_slice($this->dataStore("long_data")->data(), 0, 5);
    // echo "<pre>" . var_export($data) . "</pre>";
    // $data = array(
    //     array('productCode' => 'S10_1678', 'productName' => '1969 Harley Davidson Ultimate Chopper', 'productLine' => 'Motorcycles', 'productScale' => '1:10', 'productVendor' => 'Min Lin Diecast', 'productDescription' => 'This replica features working kickstand, front suspension, gear-shift lever, footbrake lever, drive chain, wheels and steering. All parts are particularly delicate due to their precise scale and require special care and attention.', 'quantityInStock' => '7933', 'buyPrice' => '48.81', 'MSRP' => '95.7'),
    //     array('productCode' => 'S10_1949', 'productName' => '1952 Alpine Renault 1300', 'productLine' => 'Classic Cars', 'productScale' => '1:10', 'productVendor' => 'Classic Metal Creations', 'productDescription' => 'Turnable front wheels; steering function; detailed interior; detailed engine; opening hood; opening trunk; opening doors; and detailed chassis.', 'quantityInStock' => '7305', 'buyPrice' => '98.58', 'MSRP' => '214.3'),
    //     array('productCode' => 'S10_2016', 'productName' => '1996 Moto Guzzi 1100i', 'productLine' => 'Motorcycles', 'productScale' => '1:10', 'productVendor' => 'Highway 66 Mini Classics', 'productDescription' => 'Official Moto Guzzi logos and insignias, saddle bags located on side of motorcycle, detailed engine, working steering, working suspension, two leather seats, luggage rack, dual exhaust pipes, small saddle bag located on handle bars, two-tone paint with chrome accents, superior die-cast detail , rotating wheels , working kick stand, diecast metal with plastic parts and baked enamel finish.', 'quantityInStock' => '6625', 'buyPrice' => '68.99', 'MSRP' => '118.94'),
    //     array('productCode' => 'S10_4698', 'productName' => '2003 Harley-Davidson Eagle Drag Bike', 'productLine' => 'Motorcycles', 'productScale' => '1:10', 'productVendor' => 'Red Start Diecast', 'productDescription' => 'Model features, official Harley Davidson logos and insignias, detachable rear wheelie bar, heavy diecast metal with resin parts, authentic multi-color tampo-printed graphics, separate engine drive belts, free-turning front fork, rotating tires and rear racing slick, certificate of authenticity, detailed engine, display stand, precision diecast replica, baked enamel finish, 1:10 scale model, removable fender, seat and tank cover piece for displaying the superior detail of the v-twin engine', 'quantityInStock' => '5582', 'buyPrice' => '91.02', 'MSRP' => '193.66'),
    //     array('productCode' => 'S10_4757', 'productName' => '1972 Alfa Romeo GTA', 'productLine' => 'Classic Cars', 'productScale' => '1:10', 'productVendor' => 'Motor City Art Classics', 'productDescription' => 'Features include: Turnable front wheels; steering function; detailed interior; detailed engine; opening hood; opening trunk; opening doors; and detailed chassis.', 'quantityInStock' => '3252', 'buyPrice' => '85.68', 'MSRP' => '136'),
    // );
    Table::create(array(
        "dataSource" => $this->dataStore('long_data'),
        "columns" => array(
            "productName" => array(
                "label" => "Product Name"
            ),
            "productLine" => array(
                "label" => "Line"
            ),
            "quantityInStock" => array(
                "label" => "Qty In Stock"
            )
        ),
        "cssClass" => array(
            "table" => "table-bordered table-striped table-hover"
        ),
        "paging" => array(
            "pageSize" => 10,
            "pageIndex" => 0,
        ),
    ));
    ?>
</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