This is a migrated thread and some comments may be shown as answers.

show/hide optionalLable on run time

1 Answer 733 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
rafi
Top achievements
Rank 1
rafi asked on 22 Dec 2014, 03:24 PM
Hi,

How can i enable/disable the optional label according to changes that occurs in the view model?

my dropDownList looks like this:

<input id="children" data-bind="kendoDropDownList: { optionLabel: optionLabel, dataTextField: 'text', dataValueField: 'value', data: children, value: selectedChild, change: onChangeChild }" />

the optionLabel is bound to observable objects that contains an empty string- which means null, or to other string.
but the kendoDropDownList doesn't change when this value changes in the model.

is there any option to sent an observable value for the optionLabel?

thanks!

1 Answer, 1 is accepted

Sort by
0
Accepted
Alexander Popov
Telerik team
answered on 24 Dec 2014, 09:33 AM
Hello Rafi,

The DropDownList does not support binding of the optionLabel, however it is possible to achieve the same using a custom binding. Changing the option label can be done by using the setOptions method, then refreshing the widget. For example: 
ddl.setOptions({optionLabel: "New label"});
ddl.refresh();
Another approach would be to subscribe to the observable's change event and apply the same logic.

Regards,
Alexander Popov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
DropDownList
Asked by
rafi
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Share this question
or