如果我用鼠标在 Kendo UI 日期选择器中选择日期,我的观察者(绑定的 viewModel)会看到更改。但是,如果我在代码中设置 datepicker 的值,如下所示:
$("#dateFromFilter").data("kendoDatePicker").value(todayDate);
观察者没有捕捉到事件:
dateRangeViewModel = kendo.observable({
selectedDateFrom: null,
onChange: function (e) {
// selectedDateFrom is not changing because datePicker change event don't work for this
console.log("date: " + kendo.toString(this.get("selectedDateFrom"), "D"));
}
});
kendo.bind($("#dateFromFilter"), dateRangeViewModel);
这是正确的行为吗?如何解决问题?
JSfidler:http: //jsfiddle.net/asartem/q5xoyhx9/11/