Skip to content

Commit 14c85b4

Browse files
authored
Merge pull request #366 from telerik/selects-grouping
docs: document AutoComplete, ComboBox and DropDownList grouping
2 parents 1ba8989 + c296a14 commit 14c85b4

22 files changed

+250
-19
lines changed

components/autocomplete/data-bind.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Data Binding the AutoComplete for Blazor.
55
slug: autocomplete-databind
66
tags: telerik,blazor,autocomplete,data,bind,binding,databind
77
published: True
8-
position: 1
8+
position: 5
99
---
1010

1111
# AutoComplete Data Binding

components/autocomplete/events.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Events in the AutoComplete for Blazor.
55
slug: autocomplete-events
66
tags: telerik,blazor,autocomplete,events
77
published: true
8-
position: 20
8+
position: 35
99
---
1010

1111
# AutoComplete Events

components/autocomplete/filter.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Filtering in the ComboBox for Blazor.
55
slug: autocomplete-filter
66
tags: telerik,blazor,combo,autocomplete,filter
77
published: True
8-
position: 3
8+
position: 10
99
---
1010

1111
# AutoComplete Filter

components/autocomplete/grouping.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
title: Grouping
3+
page_title: AutoComplete - Grouping
4+
description: Grouping in the AutoComplete for Blazor.
5+
slug: components/autocomplete/grouping
6+
tags: telerik,blazor,autocomplete,group,grouping
7+
published: True
8+
position: 15
9+
---
10+
11+
# AutoComplete Grouping
12+
13+
The AutoComplete component allows users to see the listed items grouped in categories. This can improve the user experience and make browsing through the items faster.
14+
15+
To enable AutoComplete grouping, set the `GroupField` parameter to a field name from the model. The AutoComplete will display the corresponding field values as group headers in the dropdown. Nested values of complex object properties are supported (see the example below).
16+
17+
The group headers can stick to the top of the dropdown during scrolling. In other words, users will always know which is the group of the current topmost items in the scrollable list.
18+
19+
>caption Grouping in the AutoComplete
20+
21+
````CSHTML
22+
<TelerikAutoComplete Data="@Data"
23+
@bind-Value="@SelectedValue"
24+
GroupField="Category.CategoryName"
25+
TextField="ProductName"
26+
ValueField="ProductId"
27+
Placeholder="Select a product">
28+
</TelerikAutoComplete>
29+
30+
@code {
31+
public List<Product> Data { get; set; }
32+
public int? SelectedValue { get; set; }
33+
34+
protected override void OnInitialized()
35+
{
36+
List<Product> products = new List<Product>();
37+
for (int i = 0; i < 20; i++)
38+
{
39+
products.Add(new Product()
40+
{
41+
ProductId = i,
42+
ProductName = $"Product {i}",
43+
Category = new Category() { CategoryId = i % 5, CategoryName = $"Category {i % 5}" }
44+
});
45+
}
46+
47+
Data = products;
48+
49+
base.OnInitialized();
50+
}
51+
52+
public class Product
53+
{
54+
public int ProductId { get; set; }
55+
public string ProductName { get; set; }
56+
public Category Category { get; set; }
57+
}
58+
59+
public class Category
60+
{
61+
public int CategoryId { get; set; }
62+
public string CategoryName { get; set; }
63+
}
64+
}
65+
````
66+
67+
# Notes
68+
69+
* One level of grouping is supported.
70+
* The `DefaultItem` (e.g. "Select item...") is always rendered above the sticky group header in the dropdown.
71+
* A grouped AutoComplete will provide a `Groups` property with a single [`GroupDescriptor`](https://docs.telerik.com/blazor-ui/api/Telerik.DataSource.GroupDescriptor) in the [`DataSourceRequest`](https://docs.telerik.com/blazor-ui/api/Telerik.DataSource.DataSourceRequest) argument of its [OnRead event]({%slug components/autocomplete/events%}#onread). This will allow the developer to apply grouping with [manual data operations]({%slug components/grid/manual-operations%}).
72+
* `GroupHeaderTemplate` and `GroupItemTemplate` will be introduced in a future version. Currently there is a bug in the Blazor framework that prevents us from supporting them.
73+
* Virtual scrolling with grouping will be supported in a future version.
74+
75+
## See Also
76+
77+
* [Live Demo: AutoComplete Grouping](https://demos.telerik.com/blazor-ui/autocomplete/grouping)

components/autocomplete/refresh-data.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Refresh Autocomplete Data using Observable Data or creating a new C
55
slug: autocomplete-refresh-data
66
tags: telerik,blazor,autocomplete,observable,data,new,collection
77
published: True
8-
position: 15
8+
position: 30
99
---
1010

1111
# Autocomplete - Refresh Data

components/autocomplete/templates.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Templates in the AutoComplete for Blazor.
55
slug: autocomplete-templates
66
tags: telerik,blazor,combo,autocomplete,templates
77
published: True
8-
position: 5
8+
position: 20
99
---
1010

1111
# AutoComplete Templates

components/autocomplete/virtualization.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: UI virtualization to allow large data sources in the AutoComplete f
55
slug: autocomplete-virtualization
66
tags: telerik,blazor,AutoComplete,virtualization
77
published: True
8-
position: 5
8+
position: 25
99
---
1010

1111
# AutoComplete Virtualization

components/combobox/custom-value.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Custom values and user input in the ComboBox for Blazor.
55
slug: components/combobox/custom-value
66
tags: telerik,blazor,combo,combobox,custom,value,input
77
published: True
8-
position: 4
8+
position: 20
99
---
1010

1111
# ComboBox Custom Values

components/combobox/data-bind.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Data Binding the ComboBox for Blazor.
55
slug: components/combobox/databind
66
tags: telerik,blazor,combobox,combo,data,bind,binding,databind
77
published: True
8-
position: 1
8+
position: 5
99
---
1010

1111
# ComboBox Data Binding

components/combobox/events.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Events in the ComboBox for Blazor.
55
slug: components/combobox/events
66
tags: telerik,blazor,combobox,combo,events
77
published: true
8-
position: 20
8+
position: 40
99
---
1010

1111
# ComboBox Events

0 commit comments

Comments
 (0)