Example of Custom Aggregate in ASP.NET Core Tree Grid Control

Tree Grid
Aggregates
Custom Aggregate

This sample demonstrates custom aggregate functionality of the TreeGrid. In this sample, the custom aggregate value for the columns "Category" is displayed in column footer with dropdown to display the count of selected category name.

1
Order 1
Seafood1395$47$1,395
1.1
Mackerel
Frozen Seafood235$12$235
1.2
Yellowfin Tuna
Frozen Seafood324$8$324
1.3
Herrings
Frozen Seafood488$11$488
1.4
Preserved Olives
Edible125$9$125
1.5
Sweet corn Frozen
Edible223$7$223
2
Order 2
Products1944$58$1,944
2.1
Tilapias
Frozen Seafood278$15$278
2.2
White Shrimp
Frozen Seafood560$7$560
2.3
Fresh Cheese
Dairy323$12$323
2.4
Blue Veined Cheese
Dairy370$15$370
2.5
Butter
Dairy413$9$413
3
Order 3
Crystals1944$58$1,944
3.1
Lead glassware
Solid crystals542$6$542
3.2
Pharmaceutical Glassware
Solid crystals324$11$324
3.3
Glass beads
Solid crystals254$16$254

The TreeGrid supports aggregates which will be displayed at the footer and every hierarchy level. The aggregate configurations can be provided by the Aggregates property.

The built-in aggregates are,

  • Sum
  • Average
  • Min
  • Max
  • Count
  • TrueCount
  • FalseCount
  • Custom - Requires the CustomAggregate property to perform aggregation. The custom aggregate value can be accessed inside template using the key ${Custom}

In this demo, the footerTemplate property shows the custom aggregate value for the columns “Category” in column footer to display the count of category name.

The template expression should be provided inside ${...} the interpolation syntax.

More information about aggregate can be found in this documentation section.

Transform your ASP.NET Core web apps today with Syncfusion® ASP.NET Core components
100+ high-performance and responsive UI components
Dedicated support
Hassle-free licensing
TRY IT FOR FREE
opens in a new tab