Blazor DataGrid Example - Default Aggregation

DataGrid / Aggregates / Default Aggregate

This sample demonstrates the DataGrid's built-in aggregate functionality by displaying the footer aggregate value in the Freight column.

Loading Syncfusion Blazor Server Demos…

Aggregates are supported by the Blazor DataGrid and will be displayed in the footer, group footer, and group caption. The GridAggregates component can be used to provide aggregate configurations.

The built-in aggregates are as follows:

  • Sum
  • Average
  • Min
  • Max
  • Count
  • TrueCount
  • FalseCount

In this demo, the FooterTemplate is used to display two different aggregates in the DataGrid footer.

  • The Sum aggregate type value is shown in the Freight column in the first aggregate row. To accomplish this, you must define Type and Field property values as Freight, which will be used to perform the aggregation. Inside the FooterTemplate, the sum value is accessed via its Type name SumValue.Sum, where SumValue is an implicit named parameter - Context. Before being displayed, the Sum value will be formatted according to its Format value(C2).

  • The Average aggregate type value is shown in the Freight column in the second aggregate row. To accomplish this, you must define Type and Field property value as Freight, which will be used to perform the aggregation. Inside the FooterTemplate, the aggregate value is accessed via its Type name (AverageValue.Average), where AverageValue is an implicit named parameter - Context. Before being displayed, the Average value will be formatted according to its Format value(C2).

More information about the Aggregates can be found in this documentation section.

Transform your Blazor web apps today with Syncfusion® Blazor components
145+ high-performance and responsive UI components
Dedicated support
Hassle-free licensing
TRY IT FOR FREE