Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines
Hi Eugene,
Our pivot table couldn't show the exact format as your picture describes but you could make a similar one:
->pipe(new Pivot(array(
"dimensions"=>array(
"row"=>"date, name, item_name",
),
"aggregates"=>array(
"sum"=>"used_quantity, rec_quantity, deviation, cost",
),
)))
->pipe($this->dataStore('sales'));
$dataStore = $this->dataStore('sales');
PivotTable::create(array(
"dataStore"=>$dataStore,
'rowCollapseLevels' => array(1),
'showDataHeaders' => true,
));
Hope it meets your demand. Thanks!
Thank you David, it is almost what I need but is it possible to hide some total amounts? For example, sum amounts for quantities and deviations are useless in my case. I understood you do like that to have the possibility to collapse them but is it possible to hide the sum amount for these columns?
May be this will help. Those properties allow you to hide the grand total/sub total columns/rows,
Hi Eugene,
Please try some map function like this:
PivotTable::create(array(
...
'map' => array(
'dataCell' => function($value, $cellInfo) {
$isDevSumCol = $cellInfo['fieldName'] === 'dev - sum';
$isDateTotalRow = isset($cellInfo['row']['date']['total']);
$isNameTotalRow = isset($cellInfo['row']['name']['total']);
$hide = $isDevSumCol && ($isDateTotalRow || $isNameTotalRow);
return $hide ? '' : $cellInfo['formattedValue'];
},
),
...
));
Hope this helps. Thanks!
Let KoolReport help you to make great reports. It's free & open-source released under MIT license.
Download KoolReport View demo