score:0

Accepted answer

The following does the trick (for Play 2.2):

@renderRow(label: String, lookup: (Key => BufferedContent[_])) = {
  <tr>
    <td>@label</td>
    @for(key <- data.keySet) {
      <td>@lookup(key)</td>
    }
  </tr>
}

and called like this:

@renderRow("Status", statusHtml(data.get(key).status))

Other text based entries are called like this (and will be properly HTML-escaped):

@renderRow("Status", Txt(data.get(key).foo))

Related Query

More Query from same tag