KendoDropDownList'select'事件在使用键盘时未触发

时间:2013-08-29 11:22:22

标签: events drop-down-menu kendo-ui

这与此处的问题相似 - <select> change event not fired when using keyboard

我正在寻找KendoUI的具体答案。

使用KendoDropDownList(和KendoComboBox,KendoAutoComplete等),'select'事件仅在用户使用鼠标从弹出列表中选择项目时触发。

我发现这非常违反直觉,是否提供了修复,解决方法或其他解决方案?

1 个答案:

答案 0 :(得分:1)

如果列表已展开,则使用 Enter 键触发select事件。要通过键盘扩展列表,请使用 ALT + 。如果您希望箭头键触发它,则必须在更改事件的一部分中触发select事件。

var ddl, $log;

$(function () {
    $log = $('#log');
    ddl = $("#dropdownlist").kendoDropDownList({
        change: onChange,
        select: onSelect
    }).data('kendoDropDownList');
});

function onChange(e) {
    $log.prepend("<div>event :: change (" + this.text() + ' : ' + this.value() + ")</div>" );
    ddl.trigger('select');
}

function onSelect(e) {
    $log.prepend("<div>event :: select (" + this.text() + ' : ' + this.value() + ")</div>" );
}

<强> Fiddle here

相关问题