0
我試圖找出如何禁用Html.Checkbox與給定的語法:禁用Html.CheckBox
@Html.CheckBox("checkbox_" + Model.QuestionId.ToString(), false,
new Dictionary<string, object> {{ "data-bind", "checked: $root.getResponse(@Model.QuestionId).Value" }})
淘汰賽代碼:
self.getResponse = function (questionId) {
var rv = ko.utils.arrayFirst(self.responses(), function (item) { return item.QuestionId == questionId; });
if (rv == null) {
rv = new Response(0, questionId, self.evaluationId, 0, 0, '', ''); self.responses.push(rv);
}
return rv;
}
請幫
$ root.getResponse從哪裏來? – jacqijvv
敲除:self.getResponse =函數(questionId) { 變種RV = ko.utils.arrayFirst(self.responses(),函數(項目) { 返回item.QuestionId == questionId; }); if(rv == null) rv = new Response(0,questionId,self.evaluationId,0,0,'',''); self.responses.push(rv); } return rv; } – user3272686