4 Replies Latest reply on Mar 7, 2010 8:58 AM by mark lewis

    Can we have dynamic menus in rich:panelMenuItem

    Bimal Thapa Newbie

      Hello All, Is there any way so that we can loop on rich:panelMenuItem to have dynamic menus as we can have loop in tables through rich:dataTable/rich:extendedDataTable. Or is there any other alternatives to obtain dynamic menus on richfaces.

       

      Regards,

      Mabimal

        • 1. Re: Can we have dynamic menus in rich:panelMenuItem
          Ilya Shaikovsky Master
          you could use c:forEach for that. check out demosite sources. Left navigation made in such way.
          • 2. Re: Can we have dynamic menus in rich:panelMenuItem
            mark lewis Newbie

            Hi - what about looping on both Groups and Items?

             

            I tried this but got the error following.

             

            <rich:panelMenu style="width:35%" mode="ajax"
                   
            iconExpandedTopGroup="/img/logListIcon.png"
                   
            iconCollapsedTopGroup="/img/logListIcon.png"
                   
            iconCollapsedGroup="/img/logListFolderIconClosed.png"
                   
            iconExpandedGroup="/img/logListFolderIconOpen.png"
                   
            iconGroupTopPosition="left" iconItem="/img/logFileIcon.png">

                   
            <!-- feed iteration -->
                   
            <ui:repeat items="#{PanelMenu.panelNodes}" var="map">
                       
            <rich:panelMenuGroup label="#{map.key}"
                           
            style="padding-left: 20px;">
                           
            <ui:repeat items="${map.value}" var="entry">
                               
            <rich:panelMenuItem label="#{entry}"
                                   
            action="#{PanelMenu.updateCurrent}">
                                   
            <f:param name="current" value="#{entry}" />
                               
            </rich:panelMenuItem>
                           
            </ui:repeat>
                       
            </rich:panelMenuGroup>
                   
            </ui:repeat>
               
            </rich:panelMenu>
               
            <rich:panel style="width:65%"
                   
            bodyClass="rich-laguna-panel-no-header">
                   
            <a4j:outputPanel ajaxRendered="true">
                       
            <h:outputText value="#{PanelMenu.currentLog}" id="current" />
                   
            </a4j:outputPanel>
               
            </rich:panel>

             

            |STDOUT| 2010-03-06 22:46:22,212 | ERROR | [http-8181-2]: Exception in the filter chain javax.servlet.ServletException: com.sun.facelets.component.UIRepeat cannot be cast to org.richfaces.component.UIPanelMenuItem
            • 3. Re: Can we have dynamic menus in rich:panelMenuItem
              Nick Belaevski Master
              No, it's not supported currently.
              • 4. Re: Can we have dynamic menus in rich:panelMenuItem
                mark lewis Newbie

                Nick, thanks for the response.

                 

                If I have a Map<String, ArrayList<String>> in my backing bean, how else can I get all the details into a panelMenu?

                I'm thinking something like this:

                 

                one, [two, three]

                four, [five, six]

                 

                where the panelMenuGroups are one and four and the two arrays are items within the respective groups.  Your suggestion of the nested ui:repeat method being not supported, leads me to think there is a way of doing it using pure java to do it but I'm not sure how to acheive this.  I've logged this as a separate post here: http://community.jboss.org/thread/149062?tstart=0

                 

                Any help greatly appreciated.