[英]GWTP DOM.getelementbyid() and Document.get().getelementbyid() return null
我在uibinder中添加了所有输入元素,当我尝试在onbind()中访问DOM.getElementById()时,它返回null。
试图在OnReveal()中调用DOM.getelementbyid(),它返回元素,但Textbox.wrap()抛出
java.lang.AssertionError: A widget that has an existing paent widget may not be added to the detach list
at com.google.gwt.user.client.ui.RootPanel.detachOnWindowClose(RootPanel.java:136)
at com.google.gwt.user.client.Textbox.wrap(Textbox.java:69).
但是,没有任何帮助。 请帮我解决这个问题。 什么地方出了错? 没有JSNI
谢谢,贝内特。
DOM.getElementById
仅在请求的窗口小部件实际附加到DOM
DOM.getElementById
可以使用。 在这种情况下,它可能未附加到DOM
。 为此,您需要从onLoad()
调用方法
文件:
protected void onLoad()
This method is called immediately after a widget becomes attached to the browser's document.
样品:
@Override
void onLoad()
{
DOM.getElementById("id");
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.