Hi, I created a pivot table in view with extra parameters to show column headers. I modified koolreport\pivot\widgets\PivotTable.php add columns as a parameter and modified the PivotTable.tpl.php file iterate on columns and echo as header.
view file;
PivotTable::create(array(
"dataStore" => $this->dataStore($this->reportName),
"columns" => array(
"PRODUCTDEFCODE" => array("label" => "Ürün Adı"),
"KRITIKSTOCK" => array("label" => "Kritik Stok"),
"MINSTOCK" => array("label" => "Min Stok"),
"MAXSTOCK" => array("label" => "Max Stok"),
"MIAD" => array("label" => "Miad"),
),
"columnDimension" => "column",
"rowDimension" => "row",
'totalName' => 'Toplam',
'hideSubtotalRow' => true,
'width' => '100%',
"cssClass" => array(
"table" => "table-bordered table-striped table-hover",
), "options" => array(
"searching" => true,
"paging" => true,
"fixedHeader" => true,
),
));
Datastore setup code;
$this->getDataSource()->query($this->query)->pipe(new ColumnMeta(array(
"MINSTOCK"=>array(
'type' => 'number',
),
"MAXSTOCK"=>array(
'type' => 'number',
),
"TOTAL"=>array(
'type' => 'number',
),
)))->pipe(new FillNull(array(
"newValue"=>"",
"targetColumnType"=>"number",
)))->pipe(new CalculatedColumn(array(
"PRODUCTDEFCODE"=>array(
"exp" => function($data){
return $data['PRODUCTDEFNAME'] . " (".$data['PRODUCTDEFCODE'].") ";
},
"type"=>"string",
)
)))->pipe(new Pivot(array(
"dimensions"=>array(
"column"=>"",
"row"=>"PRODUCTDEFCODE, KRITIKSTOCK, MINSTOCK, MAXSTOCK, MIAD",
),
"aggregates"=>array(
"sum"=>"TOTAL",
)
)))->pipe($this->dataStore($this->reportName));
And Result of View;
Then export this pivot table to excel like in samples,
PivotTable::create(array(
"dataSource" => $this->dataStore($this->reportName),
));
Excel Result;
Is it possibe to modify pivot excel like in view? I tried so much but I couldn't modify excel.