如何在 thymleaf 中实现上下文菜单? [英] How to achieve context menu in thymleaf?
本文介绍了如何在 thymleaf 中实现上下文菜单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想动态地在 thymeleaf 中实现上下文菜单.在这种情况下,a href"应用于整个列表,类似于数据表可点击.我需要单独点击每个列表值.
如何获取被点击的菜单的id?这样我就可以传递该 id 的值以获取该 id 的子菜单,该子菜单是该表的外键.
百里香代码:
Jquery 代码:
$(document).ready(function(){$("#menucatalog").menu();});
解决方案
您必须在您的
<a href="whatever..." th:text="${prod}">我的产品</a>
I would like to achieve context menu in thymeleaf dynamically.In this case "a href" is applied to whole list which is something like a data table click able. i need each list values to be clicked separately.
How to get the id of the menu which is clicked? so that i can pass the value of that id to get the sub menu of that id which is foreign key to that table.
Thymeleaf Code:
<ul id="menucatalog">
<div id="global-subnav">
<a href="catalog/partials/offers.html">
<li class="product_container" th:each="prod : ${menucataloglist}" th:text="${prod}">
</li></a>
</div>
</ul>
Jquery Code:
$(document).ready(function(){
$("#menucatalog").menu();
});
解决方案
you must add a element inside your
<li th:each="prod : ${menucataloglist}">
<a href="whatever..." th:text="${prod}">My product</a>
</li>
这篇关于如何在 thymleaf 中实现上下文菜单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文