没有GWTquery功能正在工作 [英] No GWTquery function is working

查看:130
本文介绍了没有GWTquery功能正在工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的项目中使用GWTquery。我已经成功添加了 jar文件,将它添加到类路径中,导入了所有的类,但仍然没有任何工作。任何人都可以告诉我我错过了什么吗?以下是代码:

  import static com.google.gwt.query.client.GQuery。*; 
import com.google.gwt.query.client.plugins.Effects;
public class myfoo implements EntryPoint {
public void onModuleLoad(){

final TextBox tb = new TextBox();
tb.setStyleName(foo);
VerticalPanel面板=新的VerticalPanel();
panel.add(tb);
$(。foo)。setText(loo);
$(。foo)。click(new Function(){
public boolean f(Event e){
tb.setText(foo);
return true ;
}
});
RootPanel.get()。add(panel);




$ b $ p
$ p

在页面加载时,文本框保持空白,没有填充与厕所

解决方案

我相信 $(。foo) code>不能与您的文本框匹配,因为它尚未添加到文档中。尝试在 $(。foo)之前移动 RootPanel.get()。add(panel)


I am trying to use GWTquery in my project. I have successfully added the jar file, added it to the class-path, imported all classes, but still nothing is working. Can anyone tell me what I am missing? Here is the code:

import static com.google.gwt.query.client.GQuery.*;
import com.google.gwt.query.client.plugins.Effects;
public class myfoo implements EntryPoint {
  public void onModuleLoad() {

        final TextBox tb = new TextBox();
        tb.setStyleName("foo"); 
        VerticalPanel panel = new VerticalPanel();
        panel.add(tb);
        $(".foo").setText("loo");
        $(".foo").click(new Function() {
            public boolean f(Event e) {
                tb.setText("foo");
                return true;  
            }
        });
        RootPanel.get().add(panel);
      }
     }

At pageload the text-box remains empty, not filled with loo. Aslo clicking on it has no effect.

解决方案

I belive $(".foo") cannot match your text box has it hasn't yet been added to the document. Try moving the RootPanel.get().add(panel) line before the $(".foo") ones.

这篇关于没有GWTquery功能正在工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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