How can I put a widget in a CellTable Cell?

后端 未结 5 2087
抹茶落季
抹茶落季 2021-02-04 03:35

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 prede

5条回答
  •  别跟我提以往
    2021-02-04 03:42

    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()); 
            }
    }
    

提交回复
热议问题