Example of Custom Aggregate in React Tree Grid Component


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


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 in this services.

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