4

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>

1 Answer 1

4

According to the PrimeFaces docs there is no straightforward way... There are no callbacks like onclick or something

But if you really want to call some js functions on your p:submenu you can use the following hack

add styleClass to your p:submenu , like this

<p:submenu styleClass="myMeineClass" label="Meine Versicherungen">

and in js use jQuery bind (for example)

$(".myMeineClass").bind("click",function(){ alert("myMeineClass was clicked"); });
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.