I'm trying to enable / disable a kendo datepicker based on the selected value of an select using Knockout-Kendo.js.
The HTML:
<select data-bind="value: test">
<option value="1">1</option>
<option value="2">2</option>
</select>
<input data-bind="kendoDatePicker: {value: date, enabled: test() == 2}" />
The JS:
ko.applyBindings({
date: ko.observable(),
test: ko.observable(),
});
The fiddle: http://jsfiddle.net/xTjqH/2/
It does initially disable the datepicker, but it wont enable it once "2" is selected.
Based on the way that dependencies are tracked for the individual options in the kendo bindings, you would need to represent your
enabled
condition with a computed. Otherwise, thetest() == 2
is evaluated immediately and never again.With your sample, you could bind against a computed like
dateEnabled
:Sample: http://jsfiddle.net/rniemeyer/JaVKt/