开发者

Setting a GWT widget's id

开发者 https://www.devze.com 2023-04-04 07:31 出处:网络
I have a FlowPanel object on gwt application. FlowPanel flowPanel = new FlowPanel(); flowPanel.add(new Button(\"Edit\"));

I have a FlowPanel object on gwt application.

FlowPanel flowPanel = new FlowPanel();
flowPanel.add(new Button("Edit"));
flowPanel.add(new Button("Delete"));
flowPanel.getElement().setId("idOfFlow");

It gives me the following error:

flowPanel.getEleme开发者_StackOverflow中文版nt().setId("idOfFlow") = No such instance method:
 'void com.google.gwt.core.client.JavaScriptObject$.setId (java.lang.String)'

How can I set the Id of the FlowPanel?


I am using GWT 2.4.0, this code works fine.

FlowPanel panel = new FlowPanel();
panel.getElement().setId("panel-id");

or

FlowPanel panel = new FlowPanel();
DOM.setElementProperty(panel.getElement(), "id", "panel-id");
0

精彩评论

暂无评论...
验证码 换一张
取 消