Example of Custom Aggregate in Javascript Tree Grid Control

/
/
Custom Aggregate

This sample demonstrates custom aggregate functionality of the Tree Grid. 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.

More Details...

1
Order 1
Seafoods1395$47.00$65,565.00
1.1
Mackerel
Frozen seafood235$12.26$2,881.10
1.2
Yellowfin Tuna
Frozen seafood324$18.45$5,977.80
1.3
Herrings
Frozen seafood488$11.45$5,587.60
1.4
Preserved Olives
Edible125$19.56$2,445.00
1.5
Sweet corn Frozen
Edible223$12.34$2,751.82
2
Order 2
Products1944$58.45$1,245.73
2.1
Tilapias
Frozen seafood278$15.45$4,295.10
2.2
White Shrimp
Frozen seafood560$17.66$9,889.60
2.3
Fresh Cheese
Dairy323$12.35$3,989.00
2.4
Blue Veined Cheese
Dairy370$15.77$5,834.90
2.5
Butter
Dairy413$19.45$8,032.85
3
Order 3
Crystals1120$33.45$37,464.00
3.1
Lead glassware
Solid crystals542$19.56$10,601.52
3.2
Pharmaceutical Glassware
Solid crystals324$11.36$3,680.64
3.3
Glass beads
Solid crystals254$16.11$4,091.94
Description

The Tree Grid 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. Injecting Module: Tree Grid features are segregated into individual feature-wise modules. To use aggregate feature, we need to inject Aggregate module using the TreeGrid.Inject(Aggregate) section. More information about aggregate can be found in this documentation section.