Skip to content

Commit 58c5d70

Browse files
docs(grid): grouping
1 parent dd9672f commit 58c5d70

File tree

3 files changed

+78
-0
lines changed

3 files changed

+78
-0
lines changed

components/grid/grouping.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
title: Grouping
3+
page_title: Grid for Blazor | Grouping
4+
description: Enable and configure grouping in Grid for Blazor
5+
slug: components/grid/features/grouping
6+
tags: telerik,blazor,grid,grouping
7+
published: True
8+
position: 22
9+
---
10+
11+
# Grid Grouping
12+
13+
The Grid component offers support for grouping.
14+
15+
To enable grouping, set the grid's `Groupable` property to `true`.
16+
17+
Drag a column header to the group panel and the grid will create groups in the data rows based on the available values for that field. An indicator will be shown for the column that is used for grouping.
18+
19+
You can also group by multiple fields and groups for subsequent fields will be nested within their parent groups. When adding a group, you can drag it in the desired position in the list of current groups.
20+
21+
To remove a group setting, click the `[x]` button on its indicator in the group panel.
22+
23+
>caption Enable grouping in Telerik Grid
24+
25+
````CSHTML
26+
@using Telerik.Blazor.Components.Grid
27+
28+
<TelerikGrid Data=@GridData Groupable="true" Pageable="true" Height="400px">
29+
<TelerikGridColumns>
30+
<TelerikGridColumn Field=@nameof(Employee.Name) />
31+
<TelerikGridColumn Field=@nameof(Employee.Team) Title="Team" />
32+
<TelerikGridColumn Field=@nameof(Employee.IsOnLeave) Title="On Vacation" />
33+
</TelerikGridColumns>
34+
</TelerikGrid>
35+
36+
@code {
37+
public List<Employee> GridData { get; set; }
38+
39+
protected override void OnInitialized()
40+
{
41+
GridData = new List<Employee>();
42+
var rand = new Random();
43+
for (int i = 0; i < 15; i++)
44+
{
45+
GridData.Add(new Employee()
46+
{
47+
EmployeeId = i,
48+
Name = "Employee " + i.ToString(),
49+
Team = "Team " + i % 3,
50+
IsOnLeave = i % 2 == 0
51+
});
52+
}
53+
}
54+
55+
public class Employee
56+
{
57+
public int EmployeeId { get; set; }
58+
public string Name { get; set; }
59+
public string Team { get; set; }
60+
public bool IsOnLeave { get; set; }
61+
}
62+
}
63+
````
64+
65+
>caption How groping works in the Telerik grid
66+
67+
![](images/grouping-overview.gif)
68+
69+
70+
## See Also
71+
72+
* [Live Demo: Grid Grouping](https://demos.telerik.com/blazor-ui/grid/grouping)
73+
74+
165 KB
Loading

components/grid/overview.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ The grid can sort data automatically. You can read more about this feature in th
109109

110110
The grid can filter data automatically. You can read more about thsi feature in the [Filtering]({%slug components/grid/filtering%}) article.
111111

112+
## Grouping
113+
114+
The grid can group data automatically. You can read more about this feature in the [Grouping]({%slug components/grid/features/grouping%}) article.
115+
112116
## Toolbar
113117

114118
You can define user actions in a [dedicated toolbar]({%slug components/grid/features/toolbar%}). For the moment, they are mostly custom actions, but in future versions you will be able to add features like exporting there.

0 commit comments

Comments
 (0)