Skip to content

Commit

Permalink
Document that DropDownList optionLabel is related to valueTemplate
Browse files Browse the repository at this point in the history
  • Loading branch information
ggkrustev committed Feb 19, 2016
1 parent bdc1312 commit d4b3fd4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions docs/api/javascript/ui/dropdownlist.md
Original file line number Diff line number Diff line change
Expand Up @@ -444,13 +444,15 @@ refer to [Popup](/api/javascript/ui/popup) documentation.
Define the text of the default empty item. If the value is an object, then the widget will use it as a valid data item.
Note that the optionLabel will not be available if the widget is empty.

> **Important:** If `optionLabel` is an object, it needs to have at least `dataValueField` and `dataTextField` properties. Otherwise, widget will show `undefined`.
Note that the very same optionLabel object will be passed to the [valueTemplate](/api/javascript/ui/dropdownlist#configuration-valueTemplate). **You need to ensure that all required by the valueTemplate properties are present
in the optionLabel object**.

> **Important:** Since Q1 2015 (2015.1.318), the option label is rendered as a separate header template. The benefits of this change are:
- the widget's value will be empty string even when `dataValueField` and `dataTextField` options are equal or not defined
- the widget will not throw an exception when a custom item template is used and `optionLabel` is string
- option label has a separate template, that gives more freedom for customization

> **Important:** If `optionLabel` is an object, it needs to have at least `dataValueField` and `dataTextField` properties. Otherwise, widget will show `undefined`.
> **Important:** [Not relevant after Q1 2015] Widget's value will be equal to the `optionLabel` if the `dataValueField` and `dataTextField` options are equal or not defined
#### Example - specify optionLabel as a string
Expand Down

0 comments on commit d4b3fd4

Please sign in to comment.