I have list of objects, that I would like to render using Play Framework templates.
@(cats: List[Category])
@category(cat: Category) = {
<td><button class="btn btn-info">@cat.name</button></td>
}
<div class="modal-body">
<table class="table">
<tbody>
@cats.map { case cat =>
@category(cat)
}
</tbody>
</table>
</div>
So if I will have 9 elements in the list, they all will be in a single row.
What I want to have is a row with maximum of 3 elements. So it'll be like:
A B C
D E F
G H I
I thought I can zip my list with index list and set every third element as a new row. But I'm not sure how to do it.
Ideas?
Thanks.