设置GWT小部件的ID [英] Setting a GWT widget's id

查看:97
本文介绍了设置GWT小部件的ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  FlowPanel flowPanel = new FlowPanel();我们有一个FlowPanel对象。 
flowPanel.add(new Button(Edit));
flowPanel.add(new Button(Delete));
flowPanel.getElement()。setId(idOfFlow);

它给了我以下错误:

  flowPanel.getElement()。setId(idOfFlow)=没有这样的实例方法:
'void com.google.gwt.core.client.JavaScriptObject $ .setId(java .lang.String)'

如何设置 FlowPanel的ID ?

解决方案

我正在使用GWT 2.4.0,此代码正常工作。

  FlowPanel面板= new FlowPanel(); 
panel.getElement()。setId(panel-id);

  FlowPanel面板=新的FlowPanel(); 
DOM.setElementProperty(panel.getElement(),id,panel-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.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?

解决方案

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");

这篇关于设置GWT小部件的ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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