DataTables
How to group similar column cells with rowspan
customerName
|
productLine
|
productName
|
dollar_sales
|
---|---|---|---|
Australian Collectors, Co. | Motorcycles | 1996 Moto Guzzi 1100i | 3,449 |
Australian Collectors, Co. | Motorcycles | 2003 Harley-Davidson Eagle Drag Bike | 7,305 |
Australian Collectors, Co. | Motorcycles | 1936 Harley Davidson El Knucklehead | 2,647 |
Australian Collectors, Co. | Motorcycles | 1997 BMW R 1100 S | 3,866 |
Australian Collectors, Co. | Motorcycles | 1960 BSA Gold Star DBD34 | 2,460 |
Australian Collectors, Co. | Motorcycles | 1997 BMW F650 ST | 2,088 |
Australian Collectors, Co. | Planes | P-51-D Mustang | 2,401 |
Australian Collectors, Co. | Planes | 1928 British Royal Navy Airplane | 3,627 |
Australian Collectors, Co. | Planes | 1900s Vintage Tri-Plane | 2,080 |
Australian Collectors, Co. | Planes | American Airlines: B767-300 | 4,293 |
Australian Collectors, Co. | Planes | America West Airlines B757-200 | 1,962 |
Australian Collectors, Co. | Planes | ATA: B757-300 | 2,563 |
Australian Collectors, Co. | Planes | F/A 18 Hornet 1/72 | 3,096 |
Australian Collectors, Co. | Vintage Cars | 1928 Ford Phaeton Deluxe | 1,995 |
Australian Collectors, Co. | Vintage Cars | 1930 Buick Marquette Phaeton | 2,032 |
AV Stores, Co. | Classic Cars | 1965 Aston Martin DB5 | 4,374 |
AV Stores, Co. | Classic Cars | 1957 Ford Thunderbird | 2,604 |
AV Stores, Co. | Classic Cars | 1970 Chevy Chevelle SS 454 | 2,593 |
AV Stores, Co. | Classic Cars | 1966 Shelby Cobra 427 S/C | 1,255 |
AV Stores, Co. | Classic Cars | 1949 Jaguar XK 120 | 3,556 |
AV Stores, Co. | Classic Cars | 1952 Citroen-15CV | 5,186 |
AV Stores, Co. | Classic Cars | 1969 Chevrolet Camaro Z28 | 2,173 |
AV Stores, Co. | Classic Cars | 2002 Chevy Corvette | 3,566 |
AV Stores, Co. | Vintage Cars | 1917 Grand Touring Sedan | 6,426 |
AV Stores, Co. | Vintage Cars | 1911 Ford Town Car | 1,647 |
How to group similar column cells with rowspan
property.
<?php
DataTables::create(array(
...
"rowspan" => [0, 1], // group similar cells of the 1st and 2nd columns
));
?>
<?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(
"automaker"=>array(
"connectionString"=>"mysql:host=localhost;dbname=automaker",
"username"=>"root",
"password"=>"",
"charset"=>"utf8"
),
)
);
}
protected function setup()
{
$this->src('automaker')
->query('select * from customer_product_dollarsales2')
->pipe(new \koolreport\processes\Limit(array(200, 0)))
->pipe($this->dataStore("sales"));
}
}
<?php
use \koolreport\datagrid\DataTables;
?>
<div class="report-content">
<div class="text-center">
<h1>DataTables</h1>
<p class="lead">
How to group similar column cells with rowspan
</p>
</div>
<style>
tr[role="row"] td:first-child {
padding-left: 50px;
}
</style>
<?php
DataTables::create(array(
"dataSource"=>$this->dataStore("sales"),
"themeBase"=>"bs4", // Optional option to work with Bootsrap 4
"cssClass"=>array(
"table"=>"table table-striped table-bordered"
),
"columns" => ["customerName", "productLine", "productName", "dollar_sales"],
"rowspan" => [0, 1],
"options" => [
"paging" => true,
"searching" => true,
"pageLength" => 25,
],
));
?>
</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