Skip to content

Commit 455fc0d

Browse files
dimodidimodi
authored andcommitted
polishing and improvements
1 parent f55651d commit 455fc0d

File tree

1 file changed

+35
-8
lines changed

1 file changed

+35
-8
lines changed

knowledge-base/multicolumncombobox-grid.md

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,43 @@ This KB answers the following questions:
3434

3535
## Solution
3636

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%}).
3838

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.
4254
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
4374

4475
>caption Custom MultiColumnComboBox with an actual Grid component in the dropdown
4576
@@ -536,10 +567,6 @@ The steps and example below describe how to create a custom component that looks
536567
}
537568
````
538569

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.
542-
543570
## See Also
544571

545572
* [Grid State]({%slug grid-state%})

0 commit comments

Comments
 (0)