0 Replies Latest reply on Oct 3, 2014 4:04 PM by magwoodk

    Make all cells in a dropdown menu have an action.

    magwoodk

      We want to have our category menus go to category lists at any level including the top level.

      We create the menu items on the java side.  Here is a code snippet.

       

           HtmlDropDownMenu currentMenu = new HtmlDropDownMenu();

           currentMenu.setValue("Top Category");

       

           HtmlMenuItem menuItem = new HtmlMenuItem();

           menuItem.setValue("Sub Category");

         

            // I know this is deprecated.  It's on my to do list

           Application application = FacesContext.getCurrentInstance().getApplication();

           MethodBinding binding = application.createMethodBinging("#{bean.category}", new Class[] {});   

           menuItem.setAction(binding);

       

          HtmlActionParameter action = new HtmlActionParameter();

          actionParameter.setName("showCategory");

          actionParameter.setValue("true");

           menuItem.getChildren().add(action);

       

      Then in the jsp:

      <rich:toolBar>

        <c:forEach var="categoryMenu"

          items="#{bean.categoryMenus}">

          <rich:dropDownMenu binding="#{categoryMenu}">

          </rich:dropDownMenu>

        </c:forEach>

      </rich:toolBar>

       

      The problem is that this only allows an action  for the last leaf in the tree.  How can I set an action on the parents?

       

      Thank you for any help.