« Return to Thread: Question about recursion in a component

Question about recursion in a component

by Antonio OrdoƱez :: Rate this Message:

Reply to Author | View in Thread

Hallo everybody.

My question is about how could I implement a recursion in tapestry 5?
exactly in a tree component. I have a collection of nodes with a Node
father and a Collection children, then in the tml I have a loop and
check if the actual node is father or not, but I want execute again the
same control for each children.

<t:loop t:source="source" t:value="item">
           <t:if t:test="father">
               <tr>
                   <td width="1%" valign="top" style="cursor:pointer">
                       <img src="images/plus.gif" border="0"
onclick="javascript:UTILS_Change_Display('${item.identifier}')"/>
                   </td>
                   <td width="1%" valign="top">
                       <img src="images/folder.gif" border="0"
alt="${item.identifier}"/>
                   </td>
                   <td width="1%" nowrap="true" valign="top"
onClick="javascript:UTILS_Change_Color('name_${item.identifier}',
'black', '#0000ff');">
                       <span id="name_${item.identifier}"
style="cursor:pointer">
                           ${item.name}
                       </span>
                   </td>
                   <td width="*" valign="top">
                       <div id="${item.identifier}"
name="${item.identifier}" style="display:none">
                           <table border="0" cellspacing="0"
cellpadding="0">
                              Here I want implements the recursion (at
the momment I have another loop):
                               <t:loop t:source="item.children"
t:value="item">
                                   <tr>
                                       <td width="1%">
                                         
                                       </td>
                                       <td width="1%" valign="top"
style="padding-right:1mm">
                                           <img src="images/folder.gif"
border="0"/>
                                       </td>
                                       <td valign="top">
                                           ${item.name}
                                       </td>
                                   </tr>
                               </t:loop>
                           </table>
                       </div>
                        
                   </td>
               </tr>
           </t:if>
</t:loop>

I'm new in tapestry and I don't know if is possible or not.

Thank you very much in advanced.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...

 « Return to Thread: Question about recursion in a component

LightInTheBox - Buy quality products at wholesale price!