2016-03-30 4 views
1

Wenn ich ein Thymelblatt-Fragment erstellen, Löwenzahn dt Attribut lesen Sie nicht die Thymeleaf-Variablen.Löwenzahn Datatables Tag dt innerhalb Fragment

Ich versuche, besser mit dem Code zu erklären.

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> 

Seite

<div layout:include="fragments/components/table :: table" th:with="tableId='usersTableTest'" th:remove="tag"> 
       Default 
      </div> 

Fehler:

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 diesem Fall th:id="${tableId} korrekt arbeiten, aber dt:conf="${tableId}" nicht funktionieren.

Haben Sie Vorschläge?

Antwort

1

Ich versuchte #vars ebenso wie die Bibliothek Feder Sicherheit thymeleaf

dt:conf="#vars.tableId" 

und Arbeit gut einfügen.

+0

Ich vermute ich habe dich nicht richtig verstanden :) – sanluck