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>&nbsp;</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!

https://stackoverflow.com/questions/49658953/gwt-why-doesnt-my-call-to-tablesectionelement-setinnersafehtml-get-render


-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to