0

i have 2 ui:repeat nested like this:

<ui:repeat var="father" value="#{miuchile3.getMenusPadre(miuchile3.keyModulo)}" >
             <li>

                 <h:commandLink value="#{father.nombre}"  action="#{miuchile3.setMenu(father)}">
                 <f:ajax render=":menupags:menuDetalle" />
                 </h:commandLink>


                 <ul>
                     <ui:repeat var="submenu" value="#{miuchile3.getHijos(father.id)}" >
                         <li><h:commandLink value="#{submenu.nombre}" actionListener="#{miuchile3.setMenu(submenu)}">
                            <f:ajax  render=":menupags:menuDetalle" />
                         </h:commandLink></li>
                     </ui:repeat>


                 </ul>


               </li>



              </ui:repeat>

this generate a menu with this format

  • father menu 1

    • son menu_1
    • son menu_2

  • father menu 2

    • son menu2_1
    • son menu2_2
    • son menu2_3

etc..

when i click in this submenus i use f:ajax to render a panelgroup with details of the selected menus (it shows the pages associated to them), the problem is that it only works properly for father menu 1 and its submenus, but for father menu 2, it works ok for its 2 first submenus, if there is a third submenu associated to "father menu 2" and i click on it, it doesn't do anything.

im not sure if it is a issue with the nested ui:repeat or with f:ajax, but i think ui:repeat stop working properly after the second iteration or something like that.. the "setMenu()" function (inside the nested ui:repeat) stop working for some reason. but it could be f:ajax too.. i dont really know.

EDIT:

now i found the issue but i dont know how to solve it yet.

the problem is that for the first iteration (frist menu and its submenus) the method im calling in the action "setMenu()" works ok, but for the second iteration (father menu 2, and its submenus) the setMenu() method is called only 2 times, if there are more than 2 submenus, the method im calling in the action (setMenu())doesn't work, i mean the iteration works because it prints all the names of the menus and submenus , but the action after the first iteration only works for 2 submenus.

user2018726
  • 638
  • 2
  • 12
  • 23
  • using just action instead of actionListener happens the same thing.. in fact i just changed to actionListener to see what happens. – user2018726 Feb 18 '13 at 16:59
  • `if there is a third submenu associated` I see only 2 iteration here, so two submenus, isn't it? Is the event getting fired? I mean, if you put a breakpoint there is it passing though it? If not, try with `action` in order of `actionListener` and try it with changing the action method names, in order to avoid IDE/server publish related problems. – Aritz Feb 18 '13 at 17:37
  • this menu only support 2 levels, that why there is only 2 iterations.. my issue here is not the generation of the menu.. that is working fine, the problem is when i click in each submenu it should render its details, but it only works for my first menu and submenus, but when i click on the submenus of my second father menu it shows the details of the first 2 submenus, but if there are more, it doesnt show the details of the others.. look at the menu format i that described in my first post.. in that model everything works, except if i click in "son menu2_3", nothing happens. – user2018726 Feb 18 '13 at 17:50

1 Answers1

1

i changed the ui:repeat for a datatable, and it worked as i wanted.. i would not recomment to use ui:repeat nested if you need to invoke some action inside, it has weird behavior.

user2018726
  • 638
  • 2
  • 12
  • 23
  • Are you using Mojarra? It has indeed a [related bug](http://java.net/jira/browse/JAVASERVERFACES-1817) which is fixed in 2.1.14. – BalusC Feb 20 '13 at 20:12