0
我有一個Kendo UI組合框,裏面填充了項目列表。我有兩個按鈕,一個用於遞增,另一個用於減少組合框上的索引。按鈕具有與點擊事件相關的功能。增加/減少Kendo combobox上的選定索引
問題是組合框的索引(顯示的值未被更改)未被遞增或遞減。以下是我的方法:
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
}
}
感謝您的幫助!
awesomeness,nate。謝謝你的解釋。我完全沒有想到這一點。 –
沒問題!這就是我們在這裏。 –