这是我与百里香的春季靴子项目。控制器会将价格表返回给html。我使用th:attrappend
索引为标签<i>
提供了一个ID。
使用thymeleaf foreach priceList并创建引导程序模态。 thymeleaf确实创建了模态,但是当我单击标签<i>
“ +”时,模态不显示。
<table id="mytable" class="table table-bordred table-striped">
<thead>
<th>a</th>
<th>b</th>
<th>c</th>
</thead>
<tbody>
<tr th:each="priceData, each_index: ${priceList}">
<td th:text="${priceData.priceid}"></td>
<td th:text="${priceData.iscorrect}"></td>
<td th:text="${priceData.message}"></td>
<td data-toggle="modal"
th:attrappend="data-target='#' + ${each_index.index}"><i class="">+</i>
</td>
</tr>
</tbody>
</table>
<div th:each="priceData, each_index : ${priceList}" class="modal fade" th:attrappend="id=${each_index.index}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span>
</button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>