【发布时间】:2013-05-21 15:03:53
【问题描述】:
KendoUI 自动完成功能不允许我连续两次选择相同的项目。如果我选择一个项目,然后选择另一个项目,它当然会起作用,但不是背靠背。
通过将this.trigger('change') 放在kendoAutoComplete({}) 的select 方法中,如果您单击 列表本身中的项目,它将起作用,但是 如果您输入相同的内容并按下 Enter,则不会触发更改事件。
- 键入 Anne,单击它(注意它会将其添加到正文中(触发更改事件))
- 再试一次(没有任何反应)
只是一些示例代码:jsFiddle EXAMPLE
var autoComplete = $("#input").kendoAutoComplete({
// other methods...
select: function (e) {
console.log('---SELECT---');
// this will work if we select the same thing and SELECT the item
// from the the dropdown list,
// ** but if we push ENTER, it won't trigger this
//this.trigger('change'); // <--
},
change : function (e) {
console.log(' >> CHANGE');
$('body').append('<br>' + this.value());
}
});
【问题讨论】:
标签: javascript jquery kendo-ui autocomplete jquery-events