Gxt集中管理 [英] Gxt focus management

查看:154
本文介绍了Gxt集中管理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Gxt。我需要将焦点设置为页面上第一个启用的字段。但是我有很多页面,我想集中这种行为。在Gxt中缺少文档,所以我想知道是否有人遇到了这样的问题,可以帮助我。



现在每个组件的类都是这样的

  protected void resetFocus(){
combobox.focus();


@Override
public void show(){
super.show();
resetFocus();
}

我找到了com.extjs.gxt.ui.client。 aria.FocusManager ,但绝对不清楚,我该如何使用它。或者也许也可以根据焦点在组件上进行连接。我可以将 resetFocus 方法移动到父类。



这样的行为

<$ (){$ b $ getFocusChain()。get(0).focus(); *
}
protected void resetFocus >


解决方案

基于最后一个响应,我通过执行以下操作在GXT3窗口中工作: / p>

  @Override 
public void show(){
super.show();
Scheduler.get()。scheduleDeferred(new Scheduler.ScheduledCommand(){
@Override
public void execute(){
field.focus();
}
});





$ b

这种方式当窗口打开时,字段有焦点,你可以开始输入。


I am working with Gxt. I need to set focus to the first enabled field on the page. But I have a lot of pages and I want to centralize that behaviour. There is a lack of documentation in Gxt so I wonder if somebody has met such a problem and can help me.

Now it goes like that in each component's class

protected void resetFocus() {
    combobox.focus();
}

@Override
public void show() {
    super.show();
    resetFocus();
}

I have found com.extjs.gxt.ui.client.aria.FocusManager but is absolutely unclear how can I use it. Or maybe It is also possible to get chain of fields as they go on the component according to the focus. And I can move resetFocus method to the parent class.

Smth like that

protected void resetFocus() {
    *getFocusChain().get(0).focus();*
}

解决方案

Based on the last response, I got this to work in a GXT3 window by doing the following:

@Override
public void show() {
    super.show();
    Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
        @Override
        public void execute() {
            field.focus();
        }
    });
}

This way when the window opens, the field has focus and you can begin typing.

这篇关于Gxt集中管理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆