Skip to content

Commit

Permalink
Fix resolve total row if header or footer is false (#1255)
Browse files Browse the repository at this point in the history
  • Loading branch information
pablomadariaga authored Nov 16, 2023
1 parent 5836265 commit ece9cb6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/PowerGridComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,16 @@ private function resolveTotalRow(): void
{
collect($this->columns)
->each(function ($column) {
$hasHeaderFooter = false;
$hasHeader = false;
$hasFooter = false;

foreach (['sum', 'count', 'min', 'avg', 'max'] as $operation) {
$hasHeaderFooter = $hasHeaderFooter || data_get($column, "$operation.header") || data_get($column, "$operation.footer");
$hasHeader = $hasHeader || data_get($column, "$operation.header");
$hasFooter = $hasFooter || data_get($column, "$operation.footer");
}

$this->headerTotalColumn = $this->headerTotalColumn || $hasHeaderFooter;
$this->footerTotalColumn = $this->footerTotalColumn || $hasHeaderFooter;
$this->headerTotalColumn = $this->headerTotalColumn || $hasHeader;
$this->footerTotalColumn = $this->footerTotalColumn || $hasFooter;
});
}

Expand Down

0 comments on commit ece9cb6

Please sign in to comment.