Skip to content

Commit 91cc7f4

Browse files
dimodijivanova
authored andcommitted
docs(multiselect): Revamp draft documentation
1 parent e2a3025 commit 91cc7f4

File tree

14 files changed

+323
-560
lines changed

14 files changed

+323
-560
lines changed

_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ navigation:
128128
title: "Selection"
129129
position: 35
130130
"*components/multicolumncombobox/columns":
131-
title: "Selection"
131+
title: "Columns"
132132
position: 7
133133
"*components/treelist/data-binding":
134134
title: "Data Binding"

_contentTemplates/dropdowns/features.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,23 @@ By virtualizing the elements in the dropdown, you can use huge data sources with
2323
#end
2424

2525
#styling
26-
| Parameter | Type | Description
27-
| ----------- | ----------- | -----------|
28-
| `Width` | `string` | the width of the component. It will target both the dropdown and the main element if the dropdown has no specific width set. @[template](/_contentTemplates/inputs/inputs-width-template.md#inputs-width-information)
29-
| `Class` | `string` | the CSS class that will be rendered on the main wrapping element of the component.
26+
| Parameter | Type | Description |
27+
| --- | --- | --- |
28+
| `Class` | `string` | The CSS class that will be rendered on the main wrapping element of the component. Use it to [override the theme or apply custom styles]({%slug themes-override%}). |
29+
| `Width` | `string` | The width of the component. It will target both the dropdown and the main element if the dropdown has no specific width set. @[template](/_contentTemplates/inputs/inputs-width-template.md#inputs-width-information) |
3030
#end
3131

3232
#popup-settings
3333
@[template](/_contentTemplates/common/parameters-table-styles.md#table-layout)
3434

35-
| Parameter | Type | Description
36-
| ----------- | ----------- | -----------|
37-
| `AnimationDuration` | `int` | the animation duration of the popup.
38-
| `Class` | `string` | additional CSS class to customize the appearance of the popup.
39-
| `Height` | `string` | the height of the popup.
40-
| `MinHeight`| `string` | the minimum height of the popup.
41-
| `MaxHeight` | `string` | the maximum height of the popup.
42-
| `Width` | `string` | the width of the popup. If you don't specify a value, the dropdown width will match the anchor element width which can help with responsive layouts and 100% widths.
43-
| `MinWidth` | `string` | the minimum width of the popup.
44-
| `MaxWidth` | `string` | the maximum width of the popup.
45-
#end
35+
| Parameter | Type | Description |
36+
| --- | --- | --- |
37+
| `AnimationDuration` | `int` | The animation duration of the popup in milliseconds. |
38+
| `Class` | `string` | Additional CSS class to customize the appearance of the popup. |
39+
| `Height` | `string` | The height of the popup. |
40+
| `MinHeight`| `string` | The minimum height of the popup. |
41+
| `MinWidth` | `string` | The minimum width of the popup. |
42+
| `MaxHeight` | `string` | The maximum height of the popup. |
43+
| `MaxWidth` | `string` | The maximum width of the popup. |
44+
| `Width` | `string` | The width of the popup. If you don't specify a value, the dropdown width will match the anchor element width which can help with responsive layouts and 100% widths. |
45+
#end

components/multicolumncombobox/appearance.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Appearance settings of the MultiColumnComboBox for Blazor.
55
slug: multicolumncombobox-appearance
66
tags: telerik,blazor,multicolumncombobox,combobox,appearance
77
published: True
8-
position: 65
8+
position: 40
99
---
1010

1111
# Appearance Settings
@@ -198,4 +198,3 @@ The `FillMode` controls how the TelerikMultiColumnComboBox is filled. You can se
198198
}
199199
}
200200
````
201-

components/multicolumncombobox/columns/overview.md

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,29 @@
11
---
2-
title: Bound Column
3-
page_title: MultiColumnComboBox Bound Column
2+
title: Overview
3+
page_title: MultiColumnComboBox Columns
44
description: Data binding and bound column properties in MultiColumnComboBox for Blazor.
5-
slug: multicolumncombobox-bound-column
5+
slug: multicolumncombobox-columns-overview
66
tags: telerik,blazor,multicolumncombobox,combo,columns,bound,column,databind
77
published: True
88
position: 0
99
---
1010

11-
# MultiColumnComboBox Bound Column
11+
# MultiColumnComboBox Columns
1212

1313
This article explains how to show data in the dropdown columns of the MultiColumnComboBox.
1414

1515
## Bind Data To The Columns
1616

17-
To bind data to the `<MultiColumnComboBoxColumn>` you can use the `Field`. This parameter points to the name of field in the data source that the column will render as a string (case-sensitive). You can set it in plain text (Field="SomeField") or let .NET extract the field name from the model (Field="@nameof(MyModelClass.Field)").
17+
To bind data to the `<MultiColumnComboBoxColumn>` you can use the `Field`. This parameter points to the (case-sensitive) name of field in the data source that the column will render as a string. You can set it in plain text (`Field="SomeField"`) or let .NET extract the field name from the model (`Field="@nameof(MyModelClass.Field)"`).
1818

1919
## Parameters
2020

2121
>caption The MultiColumnComboBox provides various parameters that allow you to configure the component:
2222
23-
<style>
24-
article style + table {
25-
table-layout: auto;
26-
word-break: normal;
27-
}
28-
</style>
29-
| Parameter | Type | Description
30-
| ----------- | ----------- | -----------|
23+
@[template](/_contentTemplates/common/parameters-table-styles.md#table-layout)
24+
25+
| Parameter | Type | Description |
26+
| --- | --- | --- |
3127
| `Field` | `string` | Points to the name of field in the data source that the column will render as a string (case-sensitive). |
3228
| `Width` | `string` | Defines the width of the MultiColumnComboBoxColumn. |
3329
| `Class` | `string` | The CSS class that will be rendered on the column's content cells. |

components/multicolumncombobox/columns/templates.md

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Templates
33
page_title: MultiColumnComboBox Column Templates
44
description: Column Templates in MultiColumnComboBox for Blazor.
5-
slug: multicolumncombobox-templates
5+
slug: multicolumncombobox-columns-templates
66
tags: telerik,blazor,multicolumncombobox,combo,columns,headertemplate,celltemplate,templates
77
published: True
88
position: 10
@@ -13,16 +13,8 @@ position: 10
1313

1414
This article explains the available templates for the Columns of the MultiColumnComboBox for Blazor.
1515

16-
<style>
17-
article style + table {
18-
table-layout: auto;
19-
word-break: normal;
20-
}
21-
</style>
22-
| Template | Description
23-
| ----------- | ----------- | -----------|
24-
| [`HeaderTemplate`](#headertemplate) | The HeaderTemplate allows you to control the rendering of the column's header cell. |
25-
| [`Template`](#template) | The Template allows you to control the rendering of the column's cells. |
16+
* [`HeaderTemplate`](#headertemplate)
17+
* [`Template`](#template)
2618

2719

2820
## HeaderTemplate
@@ -119,4 +111,4 @@ The `Template` (Cell Template) allows you to control the rendering of the cells
119111
public string Name { get; set; }
120112
}
121113
}
122-
````
114+
````

components/multicolumncombobox/custom-value.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ The text entered by the user can still go into the field the combo box is bound
1616

1717
To enable custom user input set the `AllowCustom` parameter to `true`.
1818

19-
>note When custom values are enabled, the `TextField`, `ValueField` and the `Value` must be of type `string`. Otherwise an exception will be thrown. Strings are required because the user input can take any form and may not be parsable to other types (such as numbers or GUID).
19+
> When custom values are enabled, the `TextField`, `ValueField` and the `Value` must be of type `string`. Otherwise an exception will be thrown. Strings are required because the user input can take any form and may not be parsable to other types (such as numbers or GUID).
2020
21-
When custom input is allowed, the [ValueChanged event]({%slug multicolumncombobox-events%}) fires on every keystroke, and not when an item is selected, because the ComboBox component acts as a text input.
21+
When custom input is allowed, the [ValueChanged event]({%slug multicolumncombobox-events%}) fires on every keystroke, and not when an item is selected, because the MultiColumnComboBox component acts as a text input.
2222

23-
When custom values are typed in, there may be no selected item in the ComboBox. See the [ComboBox Overview - Selected Item]({%slug multicolumncombobox-overview%}#selected-item) article for details on when how item selection and `Value` work together.
23+
When custom values are typed in, there may be no selected item. See [Value and Selected Item]({%slug multicolumncombobox-data-binding%}#value-and-selected-item) for details on how item selection and `Value` work together.
2424

2525
>caption Allow custom user input in the combo box
2626
@@ -110,9 +110,6 @@ Selected value: @selectedValue
110110
````
111111

112112

113-
114113
## See Also
115114

116-
* [Live Demo: ComboBox Custom Values](https://demos.telerik.com/blazor-ui/multicolumncombobox/custom-values)
117-
118-
115+
* [Live Demo: MultiColumnComboBox Custom Values](https://demos.telerik.com/blazor-ui/multicolumncombobox/custom-values)

components/multicolumncombobox/data-bind.md

Lines changed: 25 additions & 158 deletions
Original file line numberDiff line numberDiff line change
@@ -8,190 +8,57 @@ published: True
88
position: 5
99
---
1010

11-
# ComboBox Data Binding
11+
# MultiColumnComboBox Data Binding
1212

1313
This article explains how to provide data to the MultiColumnComboBox component, the properties related to data binding and their results.
1414

1515
@[template](/_contentTemplates/common/general-info.md#valuebind-vs-databind-link)
1616

1717

18-
There are some considerations you may find useful, such as showing the `Placeholder` when the value is out of the data source range:
19-
20-
* [Considerations](#considerations)
21-
* [Value Out of Range](#value-out-of-range)
22-
* [Component Reference](#component-reference)
23-
* [Missing Value or Data](#missing-value-or-data)
24-
2518
## Bind to a Model
2619

27-
You can bind the MultiColumnComboBox to a model in your application. This is useful when you have a numerical representation of a finite list (for example, departments in a company), and you want the user to choose them based on a friendly text name.
28-
29-
To bind the MultiColumnComboBox to a model:
30-
31-
1. populate its `Data` property with the collection of items you want in the dropdown
32-
1. set the `TextField` and `ValueField` properties to point to the corresponding names of the model
33-
1. set the `Value` property to the initial value of the model. If not set, it will be populated with the first item in the data source.
34-
1. define a list of [columns]({%slug multicolumncombobox-columns-overview%}) that will render in the dropdown
35-
36-
>note The MultiColumnComboBox must be bound to a collection of models. This is required because the columns cannot render properly if the component is bound to a collection of primitive types such as string and numbers.
37-
38-
>caption Data binding a MultiColumnComboBox to a model
39-
40-
````CSHTML
41-
Selected value: @BoundValue
42-
<br />
43-
44-
<TelerikMultiColumnComboBox Data="@MultiComboData"
45-
@bind-Value="@BoundValue"
46-
ValueField="@nameof(SampleData.Id)"
47-
TextField="@nameof(SampleData.Name)">
48-
<MultiColumnComboBoxColumns>
49-
<MultiColumnComboBoxColumn Field="@nameof(SampleData.Id)" Title="The id" ></MultiColumnComboBoxColumn>
50-
<MultiColumnComboBoxColumn Field="@nameof(SampleData.Name)" Title="The name"></MultiColumnComboBoxColumn>
51-
</MultiColumnComboBoxColumns>
52-
</TelerikMultiColumnComboBox>
20+
Bind the MultiColumnComboBox to a model in your application. Unlike other dropdown components such as ComboBox or DropDownList, binding to a collection of primitive types is not supported.
5321

54-
@code {
55-
public int BoundValue { get; set; }
56-
57-
public List<SampleData> MultiComboData { get; set; } = Enumerable.Range(0, 30).Select(x => new SampleData()
58-
{
59-
Id = x,
60-
Name = "Name " + x
61-
}).ToList();
62-
63-
public class SampleData
64-
{
65-
public int Id { get; set; }
66-
public string Name { get; set; }
67-
}
68-
}
69-
````
22+
Consult the [MultiColumnComboBox basic usage example]({%slug multicolumncombobox-overview%}#creating-multiColumnComboBox).
7023

7124
@[template](/_contentTemplates/common/get-model-from-dropdowns.md#get-model-from-dropdowns)
7225

73-
## Considerations
74-
75-
The MultiColumnCombobox component attempts to infer the type of its model and value based on the provided `Data` and initial `Value`. This affects the way its [reference is obtained](#component-reference) and what happens [if you can't provide data or a value](#missing-value-or-data). Providing a [value that is not in the data source](#value-out-of-range) needs to be taken into account be the application, because the component will not change it.
76-
77-
### Value Out of Range
78-
79-
This specific is applicable for the case when [custom value input]({%slug multicolumncombobox-custom-value%}) is disabled (`AllowCustom="false"` which is its default value).
80-
81-
When the `Value` the application provides does not match any of the values present in the `ValueField` of the `Data` collection, the MultiColumnCombobox component will not change the `Value` or select a new item. In the common case, it will show up blank to indicate there is nothing selected from its data.
82-
83-
If you have set the `Placeholder` and the `Value` matches the `default` value of the type (for example, `0` for an `int` or `null` for an `int?` or `string`), you will see the `Placeholder`. A `Value` that is non-`default` will not show the `Placeholder`.
84-
85-
Handling such "unexpected" values is up to the application - for example, through defensive checks, or through form validation, or by first checking what is present in the data source before setting a new `Value`.
8626

87-
When `AllowCustom="true"`, what the user types in the input will be set to the `Value` of the component regardless of the data source.
27+
## Value and Selected Item
8828

89-
### Component Reference and Methods
29+
By default, if no `Value` is provided, the MultiColumnComboBox will appear empty, or will display the `Placeholder` string. If a `Value` is provided and `AllowCustom` is `false`, the `Value` should match an item in the data source (see the [Value Out of Range]({%slug multicolumncombobox-data-binding%}#value-out-of-range) section.
9030

91-
The TelerikMultiColumnComboBox is a generic component and its type comes from the model it is bound to and from the value field type.
31+
The MultiColumnComboBox acts as an input, so it will not always have a selected item. There will be no selected item in the following cases:
9232

93-
#### Methods
33+
* The user clears the value through the Clear button.
34+
* The user clears the value with the `Backspace` or `Del` keys.
35+
* `AllowCustom="false"` - when a custom value is typed, the MultiColumnComboBox input value will be automatically cleared on the change event (`blur` of the input or `Enter` keypress). See the table below.
36+
* `AllowCustom="true"` - when the user starts typing a custom value.
9437

95-
The MultiColumnComboBox methods are accessible through it's reference.
38+
Missing selection is most common when:
9639

97-
<style>
98-
article style + table {
99-
table-layout: auto;
100-
word-break: normal;
101-
}
102-
</style>
103-
| Method | Description |
104-
| --- | --- |
105-
| `Rebind` | Fires the [`OnRead`]({%slug multicolumncombobox-events%}#onread) event of the MultiColumnCombox. If you definded the event manually, calling the `Rebind` method will also execute the business logic in the OnRead event handler. |
40+
* The initial value is `null` as data sources rarely have items with a `null` value.
41+
* You want to let your users type in values that are not in your predefined set of options.
10642

43+
>caption If the user types text in the input, selection behaves according to the following table:
10744
108-
````CSHTML
109-
@* Get a reference to the MultiColumnComboBox and use the Rebind method *@
45+
| User input matches | `AllowCustom="true"` | `AllowCustom="false"` |
46+
| --- | --- | --- |
47+
| The `TextField` of an item | Matched item is selected. The `Value` is taken from the item. | Matched item is selected. The `Value` is taken from the item. |
48+
| The `ValueField` of an item | No item is selected. `Value` is updated to the custom input. | No item is selected. `Value` is updated to `default(typeof(Value))`. The `OnChange` event does not fire for the value clearing. |
49+
| No match | No item is selected. `Value` is updated to the custom one. | No item is selected. `Value` is updated to `default(typeof(Value))`. The `OnChange` event does not fire for the value clearing. |
11050

111-
Selected value: @BoundValue
112-
<br />
113-
114-
<TelerikButton OnClick="@RebindMultiColumnComboBox">Rebind the Component</TelerikButton>
115-
116-
<TelerikMultiColumnComboBox Data="@MultiComboData"
117-
@bind-Value="@BoundValue"
118-
ValueField="@nameof(SampleData.Id)"
119-
TextField="@nameof(SampleData.Name)" @ref="@MultiColumnComboReference">
120-
<MultiColumnComboBoxColumns>
121-
<MultiColumnComboBoxColumn Field="@nameof(SampleData.Id)" Title="The id"></MultiColumnComboBoxColumn>
122-
<MultiColumnComboBoxColumn Field="@nameof(SampleData.Name)" Title="The name"></MultiColumnComboBoxColumn>
123-
</MultiColumnComboBoxColumns>
124-
</TelerikMultiColumnComboBox>
125-
126-
@code {
127-
private TelerikMultiColumnComboBox<SampleData, int> MultiColumnComboReference { get; set; }
128-
129-
private void RebindMultiColumnComboBox()
130-
{
131-
var itemToBeAdded = new SampleData()
132-
{
133-
Id = 100,
134-
Name = "Added From Code"
135-
};
136-
137-
MultiComboData.Add(itemToBeAdded);
138-
139-
BoundValue = 100;
140-
141-
MultiColumnComboReference.Rebind();
142-
}
143-
144-
public int BoundValue { get; set; }
145-
146-
public List<SampleData> MultiComboData { get; set; } = Enumerable.Range(0, 30).Select(x => new SampleData()
147-
{
148-
Id = x,
149-
Name = "Name " + x
150-
}).ToList();
151-
152-
public class SampleData
153-
{
154-
public int Id { get; set; }
155-
public string Name { get; set; }
156-
}
157-
}
158-
````
159-
160-
### Missing Value or Data
161-
162-
In case you cannot provide either of a `Value`, or `Data`, or both when the component initializes, you need to set the corresponding type properties to the `TItem` and `TValue` properties as shown below.
163-
164-
>caption MultiColumnComboBox configuration if you cannot provide Value or Data
165-
166-
````CSHTML
167-
@*How to declare the MultiColumnComboBox if no Value or Data are provided*@
51+
@[template](/_contentTemplates/common/get-model-from-dropdowns.md#get-model-from-dropdowns)
16852

169-
<TelerikMultiColumnComboBox Data="@myComboData"
170-
TextField="MyTextField"
171-
ValueField="MyValueField"
172-
TValue="int"
173-
TItem="MyDdlModel">
174-
<MultiColumnComboBoxColumns>
175-
<MultiColumnComboBoxColumn Field="@nameof(MyDdlModel.MyValueField)"></MultiColumnComboBoxColumn>
176-
<MultiColumnComboBoxColumn Field="@nameof(MyDdlModel.MyTextField)"></MultiColumnComboBoxColumn>
177-
</MultiColumnComboBoxColumns>
178-
</TelerikMultiColumnComboBox>
17953

180-
@code {
181-
public class MyDdlModel //TItem matches the type of the model
182-
{
183-
public int MyValueField { get; set; } //TValue matches the type of the value field
184-
public string MyTextField { get; set; }
185-
}
54+
## Missing Value or Data
18655

187-
IEnumerable<MyDdlModel> myComboData = Enumerable.Range(1, 20).Select(x => new MyDdlModel { MyTextField = "item " + x, MyValueField = x });
56+
The MultiColumnCombobox component attempts to infer the type of its model and value based on the provided `Data` and initial `Value`. This affects its [object reference]({%slug multicolumncombobox-overview%}#component-reference-and-methods).
18857

189-
//the same configuration applies if the "myComboData" object is null initially and is populated on some event
190-
}
191-
````
58+
In case you cannot provide either the `Value` or `Data` initially, you need to [set the corresponding types to the `TItem` and `TValue` parameters]({%slug common-features-data-binding-overview%}#component-type).
19259

19360

19461
## See Also
19562

196-
* [ComboBox Overview]({%slug multicolumncombobox-overview%})
197-
* [Live Demo: ComboBox](https://demos.telerik.com/blazor-ui/multicolumncombobox/overview)
63+
* [MultiColumnComboBox Overview]({%slug multicolumncombobox-overview%})
64+
* [Live Demo: MultiColumnComboBox](https://demos.telerik.com/blazor-ui/multicolumncombobox/overview)

0 commit comments

Comments
 (0)