アイテムのリストが入力された Kendo UI コンボボックスがあります。コンボボックスのインデックスをインクリメントするためのボタンとデクリメントするためのボタンの 2 つのボタンがあります。ボタンには、クリック イベントに関連付けられた機能があります。
問題は、コンボボックスのインデックス (表示されている値が変更されていない) がインクリメントまたはデクリメントされていないことです。メソッドとして私が持っているものは次のとおりです。
function IncrementTraveler() {
var combobox = $("#comboTraveler").data("kendoComboBox");
var selectedIndex = parseInt(combobox.select());
alert(selectedIndex); // displays correct index
if (selectedIndex < combobox.dataSource.data().length) {
$('#comboTraveler').select(selectedIndex + 1); // nothing changes
}
}
function DecrementTraveler() {
var combobox = $("#comboTraveler").data("kendoComboBox");
var selectedIndex = parseInt(combobox.select());
alert(selectedIndex); // displays correct index
if (!(selectedIndex < 0)) {
$('#comboTraveler').select(selectedIndex - 1); // nothing changes
}
}
助けてくれてありがとう!