我怎样才能把一个小部件放入CellTable Cell? [英] How can I put a widget in a CellTable Cell?

查看:101
本文介绍了我怎样才能把一个小部件放入CellTable Cell?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用CellTable显示我的记录,但现在事情是我想在用户单击某个单元格时显示一个选择框。还有一件事是,选择框是我自己的小部件,而不是预定义的。你可以给我建议任何这样做的方法吗?

I am using CellTable to show my records but now the thing is I want show a select box when user clicks on a cell. One more thing is that select box is my own widget, not a predefined. Can you please suggest to me any method of doing this?

推荐答案

GWT的google小组上有一篇文章讨论答案。基本上,您可以像平常一样创建自定义小部件,并且在render函数中使用widget.getElement()。getInnterHTML()。

There's a post on the GWT google group that discusses the answer. Basically you create your custom widget as normal, and inside the render function you use widget.getElement().getInnterHTML().

@Override
public void render(com.google.gwt.cell.client.Cell.Context context,
            String value, SafeHtmlBuilder sb) {
        if (value != null) {
             MyWidget widget = new MyWidget(value);
             sb.appendEscaped(widget.getElement.getInnerHTML()); 
        }
}

这篇关于我怎样才能把一个小部件放入CellTable Cell?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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