Dynamically enable/disable kendo datepicker with Knockout-Kendo.js

拜拜、爱过 提交于 2019-12-06 01:16:34

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, the test() == 2 is evaluated immediately and never again.

With your sample, you could bind against a computed like dateEnabled:

var viewModel = {
    date: ko.observable(),
    test: ko.observable(), 
};

viewModel.dateEnabled = ko.computed(function() {
   return viewModel.test() === "2"; 
});

Sample: http://jsfiddle.net/rniemeyer/JaVKt/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!