<input type="checkbox" data-bind="checked: appealsFromThisCase, event: { change: onappealsFromThisCaseChange}" id="appealsforCaseCheckBox"/>
vm.onappealsFromThisCaseChange = function () {
if (vm.appealsFromThisCase())
{
vm.predicate(new breeze.Predicate("CaseId", "==", caseID));
return datacontext.getCaseAppeals().then(function () {
return true;
});
}
}
else
return vm.getAppeals();
上面是一个绑定到可观察到的appealsFromThisCase 的复选框,它最初是错误的。在更改事件上, onappealsFromThisCaseChange 被触发,我看到可观察到的 AppealsFromThisCase 在未选中复选框时给出 true,在选中复选框时给出 false。