Setting a GWT widget's id
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");
精彩评论