[英]How to toolbar`s button to be focused in ExtJS 4.2?
There is application in ExtJS and I am endeavouring to manage application without mouse. 在ExtJS中有应用程序,我正在努力管理没有鼠标的应用程序。 Some things is done, but I have no idea with toolbars button.
有些事情已经完成,但我不知道工具栏按钮。 Toolbars button cannot be focused.
工具栏按钮无法聚焦。 Although in application enabled Ext.FocusManager
虽然在应用程序中启用了Ext.FocusManager
Ext.FocusManager.enable(true);
What have to do to fix this problem? 要解决这个问题该怎么办?
var nav3 = Ext.create('Ext.util.KeyNav', Ext.getBody(), {
"enter" : function(){
var el = Ext.FocusManager.focusedCmp;
if( el.getXType() == 'menuToolbar' ){
console.log(el.items.items[0]);
el.items.items[0].focus();
}
},
scope : this
});
There are several problems in your code. 您的代码中存在几个问题。 First of all,
Ext.create
takes two arguments, you pass three. 首先,
Ext.create
有两个参数,你传递三个。 Thus the class created cannot work. 因此,创建的类无法工作。
el.items.items[0]
cannot work. el.items.items[0]
无法正常工作。 Rather use el.down('button')
to tell what component you want to select. 而是使用
el.down('button')
来告诉您要选择的组件。
Your code should probably look like this 你的代码可能看起来像这样
var nav3 = Ext.create('Ext.util.KeyNav', {
target: Ext.getBody(),
enter: function(){
var el = Ext.FocusManager.focusedCmp;
if( el.getXType() == 'menuToolbar' ){
console.log(el.down('button'));
el.down('button') .focus();
}
},
scope: this
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.