0

I am new to primefaces and already facing problems with the "selectOneMenu" component. I have implemented a mainMenu.xhtml file, which is visible on all my pages. This mainmenu has a "selectOneMenu" component for language Change. The "selectOneMenu" does not open on the start page and several other pages, but there are also pages where it opens and works as it should. I've searched the net for a couple of days now, and couldn't find any hint or suggestion, that solved my Problem. Would be very nice to find some help here.

See code below: Identity_Session is a @SessionScoped-bean; The "languageSet" is a HashMap of (String, Integer) pairs.

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <h:head>

    </h:head>
    <h:body>
        <h:form>    

            <p:panel>                       
                <h:panelGrid columns="2" cellpadding="5" style="right: 700px; position: absolute; margin-top: -7px;" rendered="#{identity_Session.showMenuLogout()}">
                    <p:outputLabel for="languageComboBox" value=" #{identity_Session.translate('outputlabel_language')}:" style="font-weight:bold"/>
                    <p:selectOneMenu id="languageComboBox" value="#{identity_Session.languageID}" style="width:150px">
                        <p:ajax listener="#{identity_Session.translationAction()}" update="@all" delay="1000"/>
                        <f:selectItems value="#{identity_Session.getLanguageSet()}" />
                    </p:selectOneMenu>
                </h:panelGrid>                        
            </p:panel>

        </h:form>
        <br/>
        <br/>
    </h:body>
</html>

UPDATE!!! I am using the same selectOneMenu with the same values (as described above) on the same webPage. When I place the selectOneMenu in the "west"-layoutUnit it does not open, but when I place it in the "east"-layoutUnit it opens. Is this actually a "PrimeFaces"-Bug, or am I missing something?

Kukeltje
  • 12,223
  • 4
  • 24
  • 47
  • what if you remove the options facet? – Kukeltje Oct 04 '16 at 07:24
  • Unfortunately it does not work. I get the following error message: javax.faces.component.html.HtmlPanelGrid cannot be cast to org.primefaces.model.menu.MenuElement. I think the reason is, a "menuBar" component consists of "menuItems", "subMenus" and "facets". I think you can't just put a "panel", "panelGrid" or other component types to a "menuBar" – shaolinmonkabbot Oct 04 '16 at 07:42
  • @all is not recommended to use, try to update whole page without ajax – Nikola Oct 04 '16 at 08:17
  • or give id to body and update that – Nikola Oct 04 '16 at 08:18
  • http://stackoverflow.com/questions/10518964/any-significant-technical-difference-between-jsf-non-ajax-submit-and-a-all-aj/ BalusC wrote about difference between @all and non-ajax – Nikola Oct 04 '16 at 08:21
  • what if you remove the options facet **and its children** (that is what I meant)? If that still fails, remove it from the code above since it does not play a role in the issue. That is working towards an [mcve]. Try that for more things. But now I see the selectOneMenu is in there. Sorry!!!. Still removing submenus etc... put static labels in there makes it a better [mcve] to – Kukeltje Oct 04 '16 at 09:12
  • PF version? And look at the `appendTo` attribute of this component – Kukeltje Nov 24 '16 at 12:59
  • I am using PF 6.0. – shaolinmonkabbot Nov 25 '16 at 05:56

1 Answers1

0

Try to change

 </f:panel> 

to

 </p:panel>
Christian
  • 827
  • 6
  • 14
  • Next time try to add some text as **why** you think this helps. And if you are not sure, add a comment. – Kukeltje Nov 24 '16 at 12:56