Custom Summary

 
Region March Sales September Sales March Change September Change Market Share
Europe
$214,424 $224,751 4.44% 3.36% 70%
Asia
$34,487 $40,726 7.21% 6.69% 52%
Oceania
$10,800 $11,000 4.63% 2.73% 80%
Middle East
$12,500 $12,990 0.80% 0.85% 58%
Africa
$68,200 $72,550 1.28% 1.42% 41%
North America
$34,500 $35,800 7.25% 5.03% 84%
South America
$18,500 $19,800 5.41% 3.54% 32%
Data grid with 7 rows and 7 columns

Our Blazor TreeList allows you to compute total summaries based on custom logic. To create a custom summary, declare a DxTreeListSummaryItem object in the TotalSummary template and set the SummaryType property to Custom. Handle the TreeList's CustomSummary event to implement a summary calculation algorithm. This event occurs multiple times as follows:

  • Before TreeList rows are processed: The event argument's SummaryStage property value is Start. At this stage, you can initialize a summary value.
  • For each data row in the processed range: The SummaryStage property value is Calculate. At this stage, you can accumulate a summary value.
  • After TreeList rows are processed: The SummaryStage property value is Finalize. At this stage, you can finalize summary calculations.

You can interrupt summary calculations at any time. To do so, set the TotalValueReady event argument to true.

To refresh TreeList summary values, call the RefreshSummary method. You can also specify the DisplayText property or handle the CustomizeSummaryDisplayText event to customize the summary's display text.

In this demo, the custom summary calculates the sum for March Sales values against selected TreeList rows. Built-in total summaries calculate the grand total for all rows and the row count.