I'm making a simple intranet web view for a ordering system to show all orders that are currently processed. However I'm stuck with the thymeleaf markup:
public class Order {
private Factory factory;
private String orderNumber;
private Date orderDate;
....
private List<Article> articles;
}
public class Article {
private String number;
private String name;
}
What i want to accomplish is the following (with 1 order + 3 articles in that order):
<table class="table table-striped table-hover table-middle table-condensed table-bordered">
<thead>
<tr>
<th>OrderNr</th>
<th>Date</th>
<th>Article Number</th>
<th>ArticleName</th>
</tr>
</thead>
<tbody>
<tr>
<td rowspan="3">Order 32</td>
<td rowspan="3">27.03.2020</td>
<td>17442</td>
<td>Screws</td>
</tr>
<tr>
<td>023423</td>
<td>Potatoe</td>
</tr>
<tr>
<td>32342</td>
<td>YetAnotherItem</td>
</tr>
</tbody>
</table>
all the common stuff should be row-spanned over all articles and the articles should be viewed one each line. However i have no idea on how to accomplish that with two th:each (one for the order, one for the articles of the order). I could "flatten" out my view (each line represented by one Line-Object) with a ton of ifs in the markup but that is a very dirty hack-around in my opinion...
Can anyone help me out with a better solution?
Thanks a lot!