I'm attempting to create a custom cell renderer for my GWT CellTable. I'm attempting to set a CSS style inside of the cell, but it's not rendering for some reason.
Here's my custom cell renderer
static class MyStringCell extends AbstractCell<String> implements Cell<String> { interface UncheckedStringTemplate extends SafeHtmlTemplates { @SafeHtmlTemplates.Template("<div style=\"{0}\"><input type=\"checkbox\"/>{1}</div>") SafeHtml cell(SafeStyles styles, SafeHtml vendorName); } private static UncheckedStringTemplate uncheckedStringTemplate = GWT.create(UncheckedStringTemplate.class); @Override public void render(com.google.gwt.cell.client.Cell.Context context, String value, SafeHtmlBuilder sb) { if (value == null) { return; } SafeHtml vendorName = SafeHtmlUtils.fromString(value); SafeStyles styles = SafeStylesUtils.fromTrustedString("noaccess;"); SafeHtml rendered = uncheckedStringTemplate.cell(styles, vendorName); sb.append(rendered); } } And here's where I'm calling the renderer
Column<MyObject, String> userNameSelectedColumn = new Column<MyObject, String>(new MyStringCell()) { @Override public String getValue(MyObject myObject) { return myObject.getName(); } }; vendorPermissions.addColumn(userNameSelectedColumn, "Objects w/ checkboxes"); This code produces this HTML fragment (notice the empty style)
<div style=""><input type="checkbox">Vendor 1</div> All this closely follows the GWT example for Creating Custom Cells and I haven't been able to figure out where this is going wrong - or if it's a bug.
Any ideas?
--You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment