Custom Grouping

 
Unit Price
Product Name Category Name Country Order Date Quantity
Unit Price: $0.00 - $10.00 (Count: 407)
Singaporean Hokkien Fried MeeGrains/CerealsFrance7/4/202110
Jack's New England Clam ChowderSeafoodBrazil7/8/202110
GeitostDairy ProductsBelgium7/9/202125
Guaraná FantásticaBeveragesSwitzerland7/11/202115
Longlife TofuProduceSwitzerland7/11/202121
Sir Rodney's SconesConfectionsMexico7/18/202110
Jack's New England Clam ChowderSeafoodGermany7/19/202116
Sir Rodney's SconesConfectionsBrazil7/19/202120
Guaraná FantásticaBeveragesAustria7/23/202128
Longlife TofuProduceAustria7/23/202136
Jack's New England Clam ChowderSeafoodSweden7/24/202125
GeitostDairy ProductsUSA7/31/202160
GeitostDairy ProductsUSA8/1/202124
GeitostDairy ProductsGermany8/5/202120
Guaraná FantásticaBeveragesItaly8/7/202112
KonbuSeafoodMexico8/8/202110
Guaraná FantásticaBeveragesSweden8/14/202112
Rhönbräu KlosterbierBeveragesSweden8/14/202130
Teatime Chocolate BiscuitsConfectionsSpain8/14/20211
Data grid with 2166 rows and 5 columns
0 rows are selected

The DevExpress Blazor Grid component supports custom data grouping. Custom data groups allow you to merge data into custom intervals or combine similar values into a single entry. In this demo, the Unit Price column is grouped by custom range values: $0.00 — $10.00, $10.00 — $20.00, etc.

To implement your own custom grouping logic, you must:

  1. Define a custom sorting algorithm (because grouping relies on sort operations). To apply a custom algorithm, set the DxGridDataColumn.SortMode property to Custom and handle the CustomSort event. In the event handler, compare column values to define associated order.
  2. Set the DxGridDataColumn.GroupInterval property to Custom and handle the CustomGroup event. In the event handler, compare column values to define whether they belong to the same group.
  3. (Optional) Handle the CustomizeGroupValueDisplayText event to modify group row text.
  4. (Optional) Implement GroupRowTemplate to display custom group row content.