[英]How to remove focus from Kendo UI AutoComplete when an Item is selected and set focus on an input element?
I am trying to shift focus from a Kendo UI AutoComplete to an input element after an item has been selected. 选择项目后,我试图将焦点从Kendo UI自动完成转移到输入元素。 I've tried this...
我已经尝试过了...
select: function (e) {
e.preventDefault();
var dataItem = this.dataItem(e.item.index());
vm.selectedProductID(dataItem.ProdID);
$('#itemQtyBox').focus();
}
But it didn't work. 但这没有用。
Seems that you cannot change focus from inside select
handler... maybe it's acceptable for you wait a little and then do it. 似乎您无法从
select
处理程序内部更改焦点...也许稍等片刻然后再执行即可。 I mean: 我的意思是:
select : function (e) {
setTimeout(function () {
$("#itemQtyBox").focus();
}, 100);
}
What I do is set a timeout (in the previous example 0.1 seconds) and then change focus (I know that it is not nice but works). 我要做的是设置一个超时(在前面的示例中为0.1秒),然后更改焦点(我知道它不好,但是可以工作)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.