Using SafeHtmlTemplate to render a Cell in a CellTree doesn't work

54 views
Skip to first unread message

Aidan O'Kelly

unread,
Oct 9, 2011, 6:54:37 PM10/9/11
to google-we...@googlegroups.com
When rendering a Cell for a CellTree (for the Leaf Nodes), if I use a SafeHtml Template, I get

com.google.gwt.core.client.JavaScriptException: (TypeError): elem is null
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:248)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)

and also, 

java.lang.AssertionError: This UIObject's element is not set; you may be missing a call to either Composite.initWidget() or UIObject.setElement()
    at com.google.gwt.user.client.ui.UIObject.getElement(UIObject.java:527)
    at com.google.gwt.user.cellview.client.CellTree.findItemByChain(CellTree.java:921)

When opening the Leaf Node's parent Node, and when selecting it, respectively. 

The Cell does actually render correctly, selection is broken and you can't close the parent mode, but it indicates the template is working. 
If I render the the cell without using a SafeHtmlTemplate everything works fine. 

Is anyone using SafeHtmlTemplates to render a CellTree's leaf nodes ? (Or can anyone point me to an example of rendering any type of Cell with a SafeHtmlTemplate? ) 

My render method looks like: 

@Override
public void render(com.google.gwt.cell.client.Cell.Context context,Foo value, SafeHtmlBuilder sb) {
SafeHtml x = MyTemplate.templateMethod(value.getBar(), value.getY()); 
sb.append(x);
}




Aidan O'Kelly

unread,
Oct 9, 2011, 7:54:07 PM10/9/11
to google-we...@googlegroups.com
Ok this was actually a problem with the template, generating incorrect HTML. Simplifying the template to a simple <div> with some text gets everything work ok.  
Reply all
Reply to author
Forward
0 new messages