Skip to content

Commit

Permalink
Fixes Column Summaries w/ Defer Loading (#1815)
Browse files Browse the repository at this point in the history
* Summary Fixes

Fixes incorrect labels on footer blade, addresses issue in DataSourceBase with Summaries not displaying, and updates PowerGridComponent so summaries update with changes to the table

* Fix applySummaries Column type

cast array to column var so it has consistent type for defer_loading = true/false

* Fixes for Tests

* Temp Remove Dehydrate

---------

Co-authored-by: luanfreitasdev <[email protected]>
  • Loading branch information
alloylab and luanfreitasdev authored Dec 21, 2024
1 parent f40eeba commit 49551ef
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion resources/views/components/table-footer.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{-- blade-formatter-enable --}}
<tr
class="{{ theme_style($theme, 'table.header.tr') }}"
class="{{ theme_style($theme, 'table.footer.tr') }}"
>
@if (data_get($setUp, 'detail.showCollapseIcon'))
<td
Expand Down
2 changes: 2 additions & 0 deletions src/DataSource/Processors/DataSourceBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ protected function applySummaries(MorphToMany|EloquentBuilder|BaseCollection|Que

$this->component->columns = collect($this->component->columns)
->map(function (array|\stdClass|Column $column) use ($results, $applySummaryFormat) {
$column = (object) $column;

$field = strval(data_get($column, 'dataField')) ?: strval(data_get($column, 'field'));

$summaries = ['sum', 'count', 'avg', 'min', 'max'];
Expand Down

0 comments on commit 49551ef

Please sign in to comment.