在我的应用中,我有一个使用枚举值的百里香叶下拉列表。
我想将其与bootstrap连接起来以提供更好的外观,我试图自己做,并且尝试在Internet上找到一些帮助,但仍然一无所获。
我的下拉列表:
<div class="dropdown">
<form th:object="${money}" th:action="@{saveOperation}" action="#" method="post">
<select th:field="*{name}">
<option th:each=" value : ${T(com.bartosz.kolej.whereismymoney.operations.model.MoneyOperations.OperationsNames).value()}"
th:value="${value}"
th:text="${value.getDisplayName()}">
</option>
</select>
<input type="number" required th:field="*{value}" class="form-controll" placeholder="value" step="0.01 "/>
<input type="submit" class="btn btn-warning" th:value="Save"/>
</form>
我想将其插入到这样的代码中:
<div class="dropdown show">
<a class="btn btn-secondary dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
Dropdown link
</a>
<div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
</div>
答案 0 :(得分:0)
类似的东西:
<div class="dropdown show">
<a class="btn btn-secondary dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
Category
</a>
<div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
<div th:each="c:${categories}">
<a class="dropdown-item" href="#" th:text="${c.getCategoryName()}">Action</a>
</div>
</div>