我有一個選擇控件,我有一個訂閱。當我不應用劍道風格時,控件按預期工作,訂閱代碼會觸發一次,並且不會在blur或任何其他原因下重新啓動。當我應用kendoDropDownList時,訂閱的行爲始終不穩定。淘汰賽訂閱選擇射擊與KendoUI不一致
$("select").kendoDropDownList();
不規律的行爲是選擇一個值,訂閱觸發。單擊另一個控件,訂閱事件再次觸發並且值未定義,即使選擇控件顯示值未更改。隨後的選擇會按預期觸發訂閱。 使用kendo時,使用選擇控件上的向下/向上箭頭也不會觸發。
<select id="newExperienceFrequency" data-bind="value: frequency, options: $root.controls.frequencies, optionsText: 'name', optionsValue: 'id', optionsCaption: 'Select', event: { mouseover: mouseoverFrequency, mouseout: mouseoffFrequency }" class="select frequencyTip" title="foo"></select>
self.proficiency.subscribe(function() {
self.proficiencyId = self.proficiency();
console.log('proficiency subscribed: ' + self.proficiency());
my.setCounterHint($("#newExperienceFrequency").val(), self.proficiency());
var tip = "Don't just list those skills your strongest in. It's just as important to add new skills you are aquiring!";
var result = $.grep(my.ajaxData.member.Proficiencies, function (e) { return e.Id == self.proficiency(); });
if (result.length == 0) {
// not found
} else if (result.length == 1) {
// access the foo property using result[0].foo
tip = result[0].Name + ':\nAutonomy: ' + result[0].Autonomy + '\nContext: ' + result[0].nContext + '\nKnowledge: ' + result[0].Knowledge + '\nWorkmanship: ' + result[0].Workmanship;
} else {
// multiple items found
}
$(".proficiencyTip").attr('title', tip).attr('alt', tip);
$(".proficiencyQuestionMark").fadeIn('slow');
});
這是一個已知的問題,還是我只是做錯了什麼?我是否試圖通過Knockout使用Kendo來爲自己做更多的工作?如果我只是使用劍道並淘汰淘汰賽,這些問題是否會消失?
優秀的觀察!我對Knockout(以及整個web 2.0)非常陌生,並會查看您的鏈接。事實證明,我找到了利用ryan niemeyer綁定Kendo的答案http://rniemeyer.github.com/knockout-kendo/web/DropDownList.html –