user2018726
user2018726

Reputation: 688

nested ui:repeat issue (or f:ajax)

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


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.

Upvotes: 0

Views: 2296

Answers (1)

user2018726
user2018726

Reputation: 688

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.

Upvotes: 1

Related Questions