Im working on a spring boot application using thymeleaf as my template engine. I have this case where I need to display a that can vary in the amount of columns. This is what I have so far:
<table class="table table-hover" th:if="${d.hasRecords()}">
<thead>
<tr>
<th:block th:eacth="h : ${d.header}">
<th th:colspan="${d.header.length}" th:text="${h}">Header Field</th>
</th:block>
</tr>
</thead>
<tbody>
<tr th:each="record : ${d.records}">
<th:block th:each="field : ${record}">
<td th:text="${field}">Dataset Field</td>
</th:block>
</tr>
</tbody>
</table>
The header
variable is a standard String[] array while the records
object is a List of string arrays. The table displays the body of the table but not the header. The only difference (as far as I can see) is that the body is a nested loop while the header is not. Can someone help explain to me why the header won't show up. And no the header array is not empty or null
Just like @holmis83 mentioned it was a misspell. Embarassing? yes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With