I'm trying to use a selectOneMenu inside a TieredMenu in a submenu to be exact, and whenever I click on the box lists all the menu is hidden, so I'm using a Jquery script with stopPropagation, but is not working correctly, now the selectOneMenu don't close the selectItem when I click out of the box. Is there a properly way to do this?
I used this two examples:
http://www.primefaces.org/showcase/ui/m ... Menu.xhtml
http://www.primefaces.org/showcase/ui/i ... Menu.xhtml
My code:
Code: Select all
<p:tieredMenu style="width:200px">
<p:submenu label="Ajax Menuitems" icon="ui-icon-refresh" >
<p:menuitem value="Save" actionListener="#{menuView.save}" update="messages" icon="ui-icon-disk" />
<p:menuitem value="Update" actionListener="#{menuView.update}" update="messages" icon="ui-icon-arrowrefresh-1-w" />
</p:submenu>
<p:submenu label="Non-Ajax Menuitem" icon="ui-icon-newwin">
<p:menuitem value="Delete" actionListener="#{menuView.delete}" update="messages" ajax="false" icon="ui-icon-close" />
</p:submenu>
<p:separator />
<p:submenu label="Navigations" icon="ui-icon-extlink">
<p:menuitem>
<p:selectOneMenu id="console" value="#{selectOneMenuView.console}">
<f:selectItem itemLabel="Select One" itemValue="" />
<f:selectItem itemLabel="Xbox One" itemValue="Xbox One" />
<f:selectItem itemLabel="PS4" itemValue="PS4" />
<f:selectItem itemLabel="Wii U" itemValue="Wii U" />
</p:selectOneMenu>
</p:menuitem>
</p:submenu>
</p:tieredMenu>
Code: Select all
<script>
$(".ui-menu-list .ui-menu-parent").on("mousedown mouseup click", function(event) {
event.stopPropagation();
});
</script>