You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: components/grid/aggregates.md
+47-15Lines changed: 47 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,39 +20,68 @@ There are several available aggregate functions under the `Telerik.Blazor.GridAg
20
20
*`Min`
21
21
*`Sum`
22
22
23
+
The `Count` aggregate can be applied to any type of field. The other aggregates can only be applied to numerical fields (e.g., `int`, `decimal`, `double`, etc.).
24
+
25
+
You can use aggregates in the following templates:
26
+
27
+
*`GroupFooterTemplate` of a `GridColumn` - a footer in the respective column that renders when the grid is grouped.
28
+
*`GroupHeaderTemplate` of a `GridColumn` - a header in the respective column that renders when the grid is grouped by that column. The `Value` field in the context carries the current group value.
29
+
23
30
To enable aggregates:
24
31
25
32
1. Set the grid's `Groupable` property to `true`.
26
33
1. Under the `GridAggregates` tag, define the `GridAggregate` entries to enable the aggregations per field you want to use.
27
-
1. Use the aggregate result in the templates that support it by casting their `context` to a `GridGroupAggregateResult`:
28
-
29
-
*`GroupFooterTemplate` - a footer in the respective column that renders when the grid is grouped.
34
+
1. Use the aggregate result in the templates that support it - their `context` is strongly typed and carries the aggregate values in the respective fields.
35
+
1. Group the grid to see the effect
30
36
31
37
You should define only aggregates that you will use to avoid unnecessary calculations that may be noticeable on large data sets.
32
38
39
+
If you try to use an aggregate that is not defined, or an aggregate over an unsupported field type, a runtime error will be thrown.
40
+
33
41
34
42
>caption Use Aggregates in the Telerik Blazor Grid
35
43
36
44
````CSHTML
37
-
@* Enable and use aggregates. To see the effect, group by a column, e.g., Team or "On Vacation" *@
45
+
@* Enable and use aggregates. To see the effect, group by a column - "Team" and then "Active Projects" *@
Copy file name to clipboardExpand all lines: components/grid/templates.md
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,9 @@ The Grid component can use templates for:
15
15
*[rows](#row-template)
16
16
*[editing of a field](#edit-template)
17
17
*[column header](#header-template)
18
+
*[column group footer](#column-group-footer)
19
+
*[group header](#group-header)
20
+
18
21
19
22
Like other Blazor content, they can receive a `context` argument that is the type of the model. To use templates, you must bind the grid to a named model.
20
23
@@ -304,6 +307,14 @@ Bound columns render the name of the field or their `Title` in their header. Thr
304
307
305
308
>note Header Templates are not available for the `GridCheckboxColumn` and the `GridCommandColumn`.
306
309
310
+
## Column Group Footer
311
+
312
+
When the grid is grouped, the columns can display a footer with information about the column data and some custom text/logic. The template is strongly typed and exposes the available aggregates values. For more information and examples, see the [Aggregates]({%slug grid-aggregates%}) article.
313
+
314
+
## Group Header
315
+
316
+
When the grid is grouped, the top row above the group provides information about the current group value by default. You can use this template to add custom content there in addition to the current value. For more information and examples, see the [Aggregates]({%slug grid-aggregates%}) article.
0 commit comments