p:子菜单可点击 [英] p:submenu clickable
本文介绍了p:子菜单可点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有可能使<p:submenu>
可点击并相应地触发操作?
Is there any possibility to make a <p:submenu>
clickable and accordingly to fire an action?
这是我的代码的样子,我也希望能够单击子菜单.
This is how my code looks like, I would like to be able to click on the submenu as well.
<p:menu styleClass="menu">
<p:submenu label="Meine Versicherungen">
<p:menuitem value="Polizzen" />
<p:menuitem value="Schäden" />
<p:menuitem value="TopKunde-Info" />
</p:submenu>
<p:submenu label="Meine Daten">
<p:menuitem value="Kundendaten" />
<p:menuitem value="Benutzerdaten" />
</p:submenu>
<p:submenu label="Diverses">
<p:menuitem value="Postfach"/>
<p:menuitem value="eKommunikationsvereinb." />
<p:menuitem value="Transport" />
</p:submenu>
</p:menu>
推荐答案
根据PrimeFaces文档,没有简单的方法……没有像onclick
之类的回调
According to the PrimeFaces docs there is no straightforward way... There are no callbacks like onclick
or something
但是,如果您真的想在p:submenu
上调用一些js函数,则可以使用以下技巧
But if you really want to call some js functions on your p:submenu
you can use the following hack
将styleClass
添加到您的p:submenu
中,就像这样
add styleClass
to your p:submenu
, like this
<p:submenu styleClass="myMeineClass" label="Meine Versicherungen">
并且在js中使用jQuery bind
(例如)
and in js use jQuery bind
(for example)
$(".myMeineClass").bind("click",function(){ alert("myMeineClass was clicked"); });
这篇关于p:子菜单可点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文