这是我的小提琴。 http://jsfiddle.net/aaScC/4/
在示例中,对于StartDate属性,创建自定义绑定处理程序以获取jquery datepicker。但它不起作用请帮助。
var Goal = function(goal)
{
this.GoalTitle = ko.observable(goal?goal.GoalTitle:"");
this.StartDate = ko.observable(goal?goal.StartDate:"");
this.lstSubGoals = ko.observableArray(goal ? ko.utils.arrayMap(goal.lstSubGoals, function (goal) { return new Goal(goal) }) : []);
}
答案 0 :(得分:1)
工作小提琴:http://jsfiddle.net/aaScC/5/
-
ko.bindingHandlers.datepicker = {
init: function (element, valueAccessor, allBindingsAccessor) {
...
},
update: function (element, valueAccessor) {
...
}
};
ko.applyBindings(new GoalsModel(data), document.getElementById("goaldetailsdiv"));