sorry if it is a dumb question
but I have a menu with 1 submenu in my app (jsf - primefaces 7) the menu is on all my pages (I have a master page)
I want the submenu to be collapsed by default, I don't want to keep the state
so the user has to expand -> click on an item in the submenu
but I can't make it work
<p:menu toggleable="true">
<p:menuitem value="page1" outcome="page1"/>
<p:menuitem value="page2" outcome="page2"/>
<p:menuitem value="page3" outcome="page3"/>
<p:menuitem value="page4" outcome="page4"/>
<p:submenu label="submenu" expanded="false">
<p:menuitem value="page5" outcome="page5" />
</p:submenu>
</p:menu>
I have two problems
It's a primefaces issue, you can see it also in the Primefaces showcase, at Toggleable menu.
You can achieve the desired behavior by using
<p:menubar>
instead of
<p:menu>
for auto display on mouse hover, use
<p:menubar autoDisplay="true">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With