Reputation: 21
When I create a thymeleaf fragment, dandelion dt
attribute do not read the thymeleaf variables.
I try to explain better with the code.
Fragment
<th:block layout:fragment="table">
<div dt:conf="${tableId}">
<div dt:confType="callback" dt:type="format" dt:function="formatNumberCallback"></div>
</div>
<table th:id="${tableId}"
dt:table="true"
dt:ext="responsive">
<thead>
<tr>
<th:block layout:fragment="table-header">Default table header</th:block>
</tr>
</thead>
<tbody>
<th:block layout:fragment="table-content">Default table content</th:block>
</tbody>
</table>
</th:block>
Page
<div layout:include="fragments/components/table :: table" th:with="tableId='usersTableTest'" th:remove="tag">
Default
</div>
Error:
08:48:31,825 INFO [stdout] (http-/127.0.0.1:8080-5) org.thymeleaf.exceptions.TemplateProcessingException: Error during execution of processor 'com.github.dandelion.datatables.thymeleaf.processor.config.DivConfTypeAttrProcessor' (fragments/components/table:11)
08:48:31,825 INFO [stdout] (http-/127.0.0.1:8080-5) at org.thymeleaf.processor.AbstractProcessor.process(AbstractProcessor.java:225) ~[thymeleaf-2.1.4.RELEASE.jar:2.1.4.RELEASE]
08:48:31,826 INFO [stdout] (http-/127.0.0.1:8080-5) at org.thymeleaf.dom.Node.applyNextProcessor(Node.java:1017) ~[thymeleaf-2.1.4.RELEASE.jar:2.1.4.RELEASE]
08:48:31,826 INFO [stdout] (http-/127.0.0.1:8080-5) at org.thymeleaf.dom.Node.processNode(Node.java:972) ~[thymeleaf-2.1.4.RELEASE.jar:2.1.4.RELEASE]
In this case th:id="${tableId}
work correctly but dt:conf="${tableId}"
not work.
Do you have suggestions?
Upvotes: 1
Views: 110
Reputation: 21
I tried to insert #vars as does the library spring security thymeleaf
dt:conf="#vars.tableId"
and work well.
Upvotes: 1
Reputation: 1554
I think it's a Dandelion Datatables's bug and it's not fixed.
Here is the issue in Dandelion's repository in GitHub.
Upvotes: 0