Skip to content

Commit

Permalink
Fixed Aggregation Function rendering + docs
Browse files Browse the repository at this point in the history
  • Loading branch information
paveljanda committed Jan 21, 2020
1 parent f0926d6 commit 41de0df
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions .docs/columns.md
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,16 @@ $grid->setColumnsSummary(['price', 'amount'])
});
```

## Aggregation Function

Some column aggregation can be viewed either using columns summary or using Aggregation Function:

```php
$grid->addAggregationFunction('status', new FunctionSum('id'));
```

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`.

## Column (th>, td>) attributes

Since table cell elements are rendered using `Nette\Utils\Html`, you can easily alter their html attributes (class, data-attributes etc):
Expand Down
2 changes: 1 addition & 1 deletion src/templates/datagrid.latte
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@
{include inlineAddRow, columns => $columns}
{/if}

{if $columnsSummary && !$columnsSummary->getPositionTop()}
{if ($columnsSummary && !$columnsSummary->getPositionTop()) || $control->hasSomeAggregationFunction()}
{include columnSummary}
{/if}

Expand Down

0 comments on commit 41de0df

Please sign in to comment.