Skip to content

Commit 41de0df

Browse files
committed
Fixed Aggregation Function rendering + docs
1 parent f0926d6 commit 41de0df

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

.docs/columns.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,16 @@ $grid->setColumnsSummary(['price', 'amount'])
406406
});
407407
```
408408

409+
## Aggregation Function
410+
411+
Some column aggregation can be viewed either using columns summary or using Aggregation Function:
412+
413+
```php
414+
$grid->addAggregationFunction('status', new FunctionSum('id'));
415+
```
416+
417+
As mentioned above, there is one aggregation function prepared: `Ublaboo\DataGrid\AggregationFunction\FunctionSum`. You can implement whatever function you like, it just have to implement `Ublaboo\DataGrid\AggregationFunction\IAggregationFunction`.
418+
409419
## Column (th>, td>) attributes
410420

411421
Since table cell elements are rendered using `Nette\Utils\Html`, you can easily alter their html attributes (class, data-attributes etc):

src/templates/datagrid.latte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@
350350
{include inlineAddRow, columns => $columns}
351351
{/if}
352352

353-
{if $columnsSummary && !$columnsSummary->getPositionTop()}
353+
{if ($columnsSummary && !$columnsSummary->getPositionTop()) || $control->hasSomeAggregationFunction()}
354354
{include columnSummary}
355355
{/if}
356356

0 commit comments

Comments
 (0)