将焦点设置在剑道网格中弹出编辑表单的第一个字段上 [英] Setting focus on first field of a pop up edit form in kendo grid
本文介绍了将焦点设置在剑道网格中弹出编辑表单的第一个字段上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个弹出编辑模式的剑道网格.弹出表单的第一个字段是自动完成小部件.每当弹出表单弹出时,我都想关注它.我试图以不同的方式做到这一点
I have a kendo grid in pop up edit mode. First field of the pop up form is auto complete widget. I want to give focus on it whenever the pop up form pops up. I tried to do this in different way as
$("#grid").kendoGrid({
editor:
function(container, options) {
$('<input id="item_code_focus" name="' + options.field + '"/>')
.appendTo(container)
.kendoAutoComplete({
-----
-----
}).focus()
}
});
但是它不起作用.请帮帮我?...
But it is not working. Please help me?...
推荐答案
您可以尝试使用 编辑 Grid 事件.
You could try and use the edit event of the Grid.
edit:function(e){
e.container.data('kendoWindow').bind('activate',function(e){
$('#autocomplete').focus();
})
},
实际上您应该使用 Window activate 事件来调用焦点.这是示例.@OnaBai 在使用编辑时调用焦点不会使输入失去焦点 - 实际上动画会导致这种行为.
Actually you should use the Window activate event to call focus. Here is example. @OnaBai calling focus when using the edit does not make the input to lose focus - actually the animation causes this behavior.
这篇关于将焦点设置在剑道网格中弹出编辑表单的第一个字段上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文