john
john

Reputation: 787

Nest Custom GWT Data Grid

I'm trying to figure out if the following picture is possible in GWT with a custom Data Grid. I have each row that contains customer information and then a second Data Grid to the right that shows orderline information. I'm basing it loosely off the GWT example, but that only shows "friends" with the same attributes under each person, and doesn't show a nest Data Grid. So is this possible? any tips on where to start? I've done a normal Data Grid but this is a little more complex so advice or examples would be helpful. Smart GWT is not an option.

enter image description here

Upvotes: 0

Views: 365

Answers (1)

Momo
Momo

Reputation: 2491

Not the optimal solution but you can have nested html table code in the Cell

Example

...
 userColumn = new Column<User, SafeHtml>(new SafeHtmlCell()) {
      @Override
      public SafeHtml getValue(User user) {
        SafeHtmlBuilder sb = new SafeHtmlBuilder();
        sb.appendHtmlConstant("<table style=\"width:100%\">");
        for (Product product : user.getProducts()) {
            sb.appendHtmlConstant("<tr>");
            sb.appendHtmlConstant("<td>" +product.getProductNumber()+"</td>");
            sb.appendHtmlConstant("<td>" +product.getName()+"</td>");
            sb.appendHtmlConstant("<td>" +product.getQuality()+"</td>");
            sb.appendHtmlConstant("<tr>");
        }
        sb.appendHtmlConstant("</table>");
        return sb.toSafeHtml();
      }
    };

Upvotes: 2

Related Questions