Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting a GWT widget's id

Tags:

java

gwt

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.getElement().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?

like image 219
Elbek Avatar asked Sep 11 '11 19:09

Elbek


1 Answers

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");
like image 79
Ammar Avatar answered Nov 07 '22 15:11

Ammar