3 Replies Latest reply on Mar 26, 2008 4:42 PM by kofa72

    Use Panelmenu

    kofa72

      Hi,

      For my Navigation in my Webapp i try to use the panelmenu source code where i have found of the richFaces Website (http://livedemo.exadel.com/richfaces-demo/richfaces/panelMenu.jsf).

      The problem is that i want build the panelMenuItem dynamically.
      Therefore i tried with a datalist to iterate my list over the panelMenuItem.

      <h:panelGrid columns="2" columnClasses="cols" width="100%">
       <rich:panelMenu style="width:200px" mode="ajax"
       iconExpandedGroup="disc" iconCollapsedGroup="disc"
       iconGroupTopPosition="right"
       iconCollapsedTopPosition="right" >
       <rich:panelMenuGroup label="Products">
       <rich:dataList rows="10"
       value="#{testBean.products}"
       var="prod" >
       <h:column>
       <rich:panelMenuItem id="pk"
       actionListener="#{testBean.show}">
       <h:outputText value="#{prod.name}" />
       <f:attribute name="productkat" value="#{prod}" />
       </rich:panelMenuItem>
       </h:column>
       </rich:dataList >
       </rich:panelMenuGroup>
       </rich:panelMenu>
       </h:panelGrid>


      I receive then the following error:
      'javax.faces.component.UIColumn'

      Has anyone an idea to solve this problem?

      Thanks in advance for your help.

      Fabrice

        • 1. Re: Use Panelmenu

          Use c:forEach insteed of rich:dataList

          • 2. Re: Use Panelmenu
            moldovan

            Hy!

            I have done it this way (build the whole panelMenu dynamically):

            in my jsp-site:

            <rich:panelMenu binding="#{navigationMenu.panelMenu}" width="220" />


            and in my managed Bean:
            HtmlPanelMenu panelMenu = null;
            
            public HtmlPanelMenu getPanelMenu()
             {
             if(panelMenu == null)
             {
             panelMenu = new HtmlPanelMenu();
            
             FacesContext facesContext = FacesContext.getCurrentInstance();
             Application appl = facesContext.getApplication();
             ELContext elContext = facesContext.getELContext();
             ExpressionFactory exprFactory = appl.getExpressionFactory();
            
             HtmlPanelMenuGroup menuGroup_AccountInfo = new HtmlPanelMenuGroup();
             menuGroup_AccountInfo.setLabel(myGuiUtil.getMessageResource("menugroup_account"));
             menuGroup_AccountInfo.setName(myGuiUtil.getMessageResource("menugroup_account"));
             menuGroup_AccountInfo.setIconCollapsed("triangle");
             menuGroup_AccountInfo.setIconExpanded("triangleDown");
            
             HtmlPanelMenuItem menuItem_AccountInfo = new HtmlPanelMenuItem();
             menuItem_AccountInfo.setLabel(myGuiUtil.getMessageResource("menugroup_account_products"));
             menuItem_AccountInfo.setName(myGuiUtil.getMessageResource("menugroup_account_products"));
             menuItem_AccountInfo.setActionExpression(exprFactory.createMethodExpression(elContext, "navigate_accountinfo", null, new Class[0]));
            
             menuGroup_AccountInfo.getChildren().add(menuItem_AccountInfo);
            
             panelMenu.getChildren().add(menuGroup_AccountInfo);
            
             .............
             }
            
             return panelMenu;
             }


            • 3. Re: Use Panelmenu
              kofa72

              It works now, i could solve it with the c:forEach solution.

              Many thanks at both for helping.

              Regards,
              Fabrice