3 Replies Latest reply on Aug 18, 2009 6:34 AM by palani.palanivelsway.gmail.com

    Dropdown menu

    palani.palanivelsway.gmail.com
      Hi anyone, i new in richfaces

      Any body help me,

      This is my code,

      <rich:dropDownMenu submitMode="none" value="Collateral Catalog">
        <ui:repeat value="#{productCategoryList.GetProductName()}"
                             var="newsItem">
           <rich:menuItem>
              <h:outputText value="#{newsItem.productCategoryName}"/>
           </rich:menuItem>
         </ui:repeat>
      </rich:dropDownMenu>

      This code is not working,Any problem in this code
        • 1. Re: Dropdown menu
          ralf

          I think, that what you are doing there is a misunderstood approach.

          Ui:repeat is something like a datatable for a dynamic rerendering of single rows.


          I think you have to create/manipulate the component in your bean, if you need the dynamic aspect.

          • 2. Re: Dropdown menu

            Try with c:forEach tag. In this case, neither ui:repeat nor a4j:repeat would work because rich:dropDownMenu is expecting a menuItem, and repeat tags iterate, but don´t provide that.


            For instance:


              <rich:dropDownMenu event="onclick">
                 <f:facet name="label">
                       <h:outputText value="Categories" />
                   </f:facet>
                 <c:forEach var="item" items="#{dropDownMenuBean.items}">
                    <rich:menuItem submitMode="ajax" value="#{item}" />
                 </c:forEach>
               </rich:dropDownMenu>
            



            And this is the code for dropDownMenuBean:


               public class DropDownMenuBean {
             
               private String [] menu = new String[]{"Category 1", "Category 2", "Category 3"};
             
               public String[] getItems() {
                 return menu;
               }
             
               public DropDownMenuBean() {}
            }
            



            • 3. Re: Dropdown menu
              palani.palanivelsway.gmail.com

              Hi Jaime Martin very very thanks for you,


              now i got that dropdown menu,


              regards
              jack