Reputation: 33
I'm trying to implement a menu with JSF 2.2 and Primefaces 5 I added PanelMenu of primefaces. Let's say I have a code snippet like this:
<p:panelMenu>
<p:menuitem value="Home" url="homee.xhtml" icon="ui-icon-home"/>
<p:submenu label="User Operations">
<p:menuitem value="ETC" actionListener="#{menuView.save}" icon="ui-icon-folder-open" />
<p:menuitem value="New ETC" actionListener="#{menuView.update}" icon="ui-icon-plusthick" />
</p:submenu>
</p:panelMenu>
The problem is, when I do this, that single menuItem which doesn't have a surrounding subMenu doesn't show up in the menu. How can I overcome this? Thanks.
Upvotes: 2
Views: 2600
Reputation: 21
you need to put the single menuitem inside a menu tag and outside the panelMenu :
<p:menu>
<p:menuitem value="Home" url="homee.xhtml" icon="ui-icon-home"/>
</p:menu>
<p:panelMenu>
<p:submenu label="User Operations">
<p:menuitem value="ETC" actionListener="#{menuView.save}" icon="ui-icon-folder-open" />
<p:menuitem value="New ETC" actionListener="#{menuView.update}" icon="ui-icon-plusthick" />
</p:submenu>
</p:panelMenu>
Upvotes: 2