Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I put a widget in a CellTable Cell?

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?

like image 967
vara kumar Avatar asked Jan 29 '11 06:01

vara kumar


2 Answers

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()); 
        }
}
like image 167
John Avatar answered Sep 19 '22 22:09

John


This is an anti-pattern. The whole purpose of cells is so that you do NOT have widgets: you are supposed to "render" html directly in the cell.

like image 29
Nick Hristov Avatar answered Sep 17 '22 22:09

Nick Hristov