You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: knowledge-base/multicolumncombobox-grid.md
+35-8Lines changed: 35 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,12 +34,43 @@ This KB answers the following questions:
34
34
35
35
## Solution
36
36
37
-
The steps and example below describe how to create a custom component that looks and works similar to a [Telerik MultiColumnComboBox for Blazor]({%slug multicolumncombobox-overview%}), but uses an actual [Grid component]({%slug grid-overview%}) in the dropdown.
37
+
The steps and example below describe how to create a custom component that looks and works similar to a [Telerik MultiColumnComboBox for Blazor]({%slug multicolumncombobox-overview%}), but uses an actual [Grid component]({%slug grid-overview%}) inside a [Popup component]({%slug popup-overview%}).
38
38
39
-
1. Implement UI that looks like a Telerik ComboBox. For example, use a [TextBox]({%slug components/textbox/overview%}) and a [`TextBoxSuffixTemplate`]({%slug common-features/input-adornments%}) with an [icon Button]({%slug button-icons%}) inside.
40
-
1. Add a [Telerik Popup component for Blazor]({%slug popup-overview%}) and set its `AnchorSelector` to be a selector that depends on a custom `Class` of the TextBox.
41
-
1. Add a [Telerik Grid component for Blazor]({%slug grid-overview%}) inside the Popup. Enable the features that you need.
39
+
## Prerequisites
40
+
41
+
The solution below requires familiarity with:
42
+
43
+
*[Telerik Grid for Blazor]({%slug grid-overview%}), especially the [Grid state]({%slug grid-state%}) and [Grid selection]({%slug grid-selection-overview%}).
44
+
*[Telerik Popup for Blazor]({%slug popup-overview%});
45
+
*[Telerik TextBox for Blazor]({%slug components/textbox/overview%});
46
+
* Implementing [Blazor component parameters that support two-way binding](https://learn.microsoft.com/en-us/aspnet/core/blazor/components/data-binding?view=aspnetcore-8.0#binding-with-component-parameters).
47
+
* Implementing [Blazor components with `ChildContent` that is a `RenderFragment`](https://learn.microsoft.com/en-us/aspnet/core/blazor/components/?view=aspnetcore-8.0#child-content-render-fragments).
48
+
49
+
## Steps
50
+
51
+
1. Implement UI that looks like a closed Telerik ComboBox. For example, use a [TextBox]({%slug components/textbox/overview%}) and a [`TextBoxSuffixTemplate`]({%slug common-features/input-adornments%}) with an [icon Button]({%slug button-icons%}) inside.
52
+
1. Add a [Popup]({%slug popup-overview%}) and set its `AnchorSelector` to be a selector that depends on a custom `Class` of the TextBox.
53
+
1. Add a [Grid]({%slug grid-overview%}) inside the Popup. Enable the features that you need.
42
54
1. Use [Grid row selection]({%slug grid-selection-row%}) and the Grid `SelectedItemsChanged` event to set the TextBox `Value` and the overall value of the custom MultiColumnComboBox component.
55
+
1. (optional) Extract the whole implementation to a separate generic Razor component and implement parameters such as `Value` and `Data`.
56
+
57
+
## How it Works
58
+
59
+
* The example demonstrates a generic and reusable Razor component called `ComboBoxGrid`.
60
+
* The component has several parameters, which work similar to the corresponding [MultiColumnComboBox parameters]({%slug multicolumncombobox-overview%}#multicolumncombobox-parameters):
61
+
*`Data`
62
+
*`Value`
63
+
*`TextField`
64
+
*`ValueField`
65
+
*`Width`
66
+
* Typing in the component's textbox opens the dropdown and filters the Grid, similar to a [SearchBox]({%slug grid-searchbox%}#search-from-code).
67
+
* Blurring the textbox or hitting Enter will select the first matching item in the Grid.
68
+
* Selecting a Grid item applies a new `ComboBoxGrid` value and closes the dropdown.
69
+
* Closing and reopening the dropdown preserves the Grid state.
70
+
71
+
>tip This KB article shows a custom integration scenario that uses built-in features and API of Telerik UI for Blazor components. The implementation is provided as is. It can be subject to a lot of changes and customizations by the developer, according to the business requirements.
72
+
73
+
## Example
43
74
44
75
>caption Custom MultiColumnComboBox with an actual Grid component in the dropdown
45
76
@@ -536,10 +567,6 @@ The steps and example below describe how to create a custom component that looks
536
567
}
537
568
````
538
569
539
-
## Notes
540
-
541
-
> This KB article shows a custom integration scenario that uses built-in features and API of Telerik UI for Blazor components. The implementation is provided as is. The configuration and behavior of the custom `ComboBoxGrid` component is based on common patterns, but also personal preferences. Adjust the behavior and enabled Grid features to suit your business requirements.
0 commit comments