2013-08-28 41 views
1

在我的html我想使用“th:除非”。我想比较两个即将到来的变量,如果任何一个与其他匹配,我想隐藏该原始按钮。Thymeleaf th除非

这里是我的代码..

艺术在-的Nisantasi-ID 艺术在-的Nisantasi文本 艺术在-的Nisantasi-URL 艺术在-的Nisantasi-坐标
<h3>All Contents</h3> 
<table border="1"> 
    <tr align="left"> 

     <th style="width: 20px;">Art-in-Nisantasi-Id</th> 
     <th style="width: 100px;">Art-in-Nisantasi-Text</th> 
     <th style="width: 50px;">Art-in-Nisantasi-Url</th> 
     <th style="width: 50px;">Art-in-Nisantasi-Coordinate</th> 
    </tr> 



    <tr th:each="contentType:${contentTypes}"> 
     <td th:text="${contentType.art_in_nisantasi_id}"></td> 
     <td th:text="${contentType.art_in_nisantasi_text}"></td> 
     <td th:text="${contentType.art_in_nisantasi_url}"></td> 
     <td th:text="${contentType.art_in_nisantasi_coordinate}"></td> 

    </tr> 


    <div> 
     <td 
      th:unless="${contentType.art_in_nisantasi_id}+'='+${selectedContent.art_in_nisantasi_id}"></td> 
     <td th:attr="data-id=${contentType.art_in_nisantasi_id}"> 
      <button type="button" class="action-addButton" onclick="show">Ekle</button> 

     </td> 
    </div> 

</table> 

回答

0

尝试这种方式:

<td th:unless="${contentType.art_in_nisantasi_id == selectedContent.art_in_nisantasi_id}"></td> 

此TD元素将产生或在DOM创建时二者不相等