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: components/combobox/overview.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,7 @@ Selected value: @selectedValue
34
34
IEnumerable<MyDdlModel> myComboData = Enumerable.Range(1, 20).Select(x => new MyDdlModel { MyTextField = "item " + x, MyValueField = x });
35
35
36
36
int selectedValue { get; set; } = 3; //usually the current value should come from the model data
37
-
37
+
38
38
//in a real case, the model is usually in a separate file
39
39
//the model type and value field type must be provided to the dropdpownlist
40
40
public class MyDdlModel
@@ -67,8 +67,8 @@ The ComboBox is a generic component and its type is determined by the type of th
67
67
*`TValue` - the type of the value field from the model to which the component is bound. Required if you can't provide `Data` or `Value`. Determines the type of the reference object.
68
68
*`TextField` - the name of the field from the model that will be shown to the user. Defaults to `Text`.
69
69
*`ValueField` - the name of the field from the model that will be the underlying `value`. Defaults to `Value`.
70
-
*`Value` and `bind-Value`- get/set the value of the component, can be used for binding. If you set it to a value allowed by the model class value field, the corresponding item from the data collection will be pre-selected. Use the `bind-Value` syntax for two-way binding, for example, to a variable of your own.
71
-
70
+
*`Value` and `bind-Value`- get/set the value of the component, can be used for binding. If you set it to a value allowed by the model class value field, the corresponding item from the data collection will be pre-selected. Use the `bind-Value` syntax for two-way binding, for example, to a variable of your own.
71
+
72
72
The `Value` and `ValueField` can be of types:
73
73
74
74
*`number` (such as `int`, `double` and so on)
@@ -82,13 +82,13 @@ The ComboBox is a generic component and its type is determined by the type of th
82
82
83
83
## Selected Item
84
84
85
-
By default, if no `Value` is provided, the first item from the data source will be selected. If a `Value` is provided, the first item from the data source whose `ValueField` matches will be selected.
85
+
By default, if no `Value` is provided, the ComboBox will appear empty, or will display the `Placeholder` defined.If a Value is provided, the first item from the data source whose ValueField matches will be selected.
86
86
87
87
The ComboBox will not always have a selected item, however, because it can act as an input. There will be no selected item in the following cases that depend on the settings of the component that the developer can control:
88
88
89
-
* the initial `Value` is not present in the data source,
90
89
* the user clears the value through the Clear button,
91
-
*`AllowCustom="true"` - only initial selection is possible, through the `Value` parameter and user actions remove it (see the table below).
90
+
* the user clears the value with `Backspace` or `Del` keys,
91
+
*`AllowCustom="false"` - ComboBox's input value will be automatically cleared on change event (`blur` or `Enter`) (see the table below).
92
92
93
93
94
94
Missing selection is most common when the initial value is `null` as data sources rarely have items with a `null` value, and/or when you want to let your users type in values that are not in your predefined set of options.
@@ -98,8 +98,8 @@ If the user types text in the input, selection behaves according to the followin
98
98
99
99
| User input matches an item | AllowCustom=`true`| AllowCustom=`false`|
| Yes |No item is selected. | Matching item is selected. |
102
-
| No | No item is selected. | If there was no previous selection, no item is selected. If there was previous selection, the previously selected item is selected. The `OnChange` event does not fire. |
101
+
| Yes |Matched item is selected. | Matching item is selected. |
102
+
| No | No item is selected. `Value` is updated to the custom one | No item is selected. `Value` is updated to the `default(typeof(Value))`. The `OnChange` event does not fire for the value clearing. |
103
103
104
104
105
105
@@ -108,4 +108,4 @@ If the user types text in the input, selection behaves according to the followin
0 commit comments