I have a legacy application that uses UIBinder to render the UI. I am trying to spit out records into a standard element. In my view.ui.xml file, I have a table with my semantic element setup and a element with the appropriate ui:field.
<table>
<thead>
<tr>
<th> </th>
<th>Customer #</th>
<!-- Shortened for brevity -->
</tr>
</thead>
<tbody ui:field="tbody"><!-- Note the ui:field defined -->
</tbody>
</table>
In my view.java class, I have that ui:field coupled to a TableSectionElement.
public class View extends Composite implements ViewPresenterInterface {
@UiField TableSectionElement tbody;
public TableSectionElement getTbody() {
return tbody;
}
}
In my class that handles rendering the table elements, the code is fairly straight-forward:
private void renderOrderTable() {
List<OrderToReviewProxy> sortedList = sortOrders(orders);
SafeHtmlBuilder sb = new SafeHtmlBuilder();
for(OrderToReviewProxy order : sortedList) {
sb.appendHtmlConstant("<tr>");
sb.appendHtmlConstant("<td>");
sb.appendEscaped(order.getCustomerNumber());
sb.appendHtmlConstant("</td>");
sb.appendHtmlConstant("</tr>");
}
view.getTbody().setInnerHTML(""); // Breakpoint A
view.getTbody().setInnerSafeHtml(sb.toSafeHtml()); // Breakpoint B
}
At Breakpoint A, inspecting view.getTbody() shows me the <tbody></tbody> element empty, as expected. Stepping over Breakpoint B, inspecting view.getTbody() shows me the <tbody> element with the expected HTML that the SafeHtmlBuilder generated during the for loop.
However, when I look at the rendered page, the <tbody> element has no child nodes. None of the HTML from calling sb.toSafeHtml() seems to get written into the DOM. Can anyone help me out here? I have no idea why this isn't working.
I asked this question on StackOverflow as well, in case anyone wants extar points for answering it there. I am stumped!