Seems like there are a variety of different ways to do this...
One way would be to have your list be a temporary list of lists... you divide your list into sublists of length 3 each, and each sublist is an element in a "super" list. Ugly in code. Clean in the template.

Another way to do it would be to use the mod operator in conjunction with the if components to determine whether to render a <TR> component. This one gets a little tricky because tapestry will start complaining about invalid nesting of tags... you end up having to write the tags out with, say, an input component, with "raw" set to true. So... clean in the code, ugly in the template. :)

A modification of approach #2 is something like:

.html:
<span jwcid="@For" source="ognl:collection" index="ognl:index" value="ognl:currentObject">
  <span jwcid="@Insert" value="ognl:theText" raw="true"/>
</span>

.java:

public String getTheText() {
  StringBuilder b = new StringBuilder();
  if (getIndex()%3==0) {
    if(getIndex() > 0)  {
      b.append("</tr>");
    }
    b.append("<tr>");
  }
  b.append("<td>");
  b.append(your stuff goes here);
  b.apend("</td>");
  return b.toString();
}

Something along those lines.

Robert

On Oct 8, 2007, at 10/81:27 PM , Ken nashua wrote:


Ok I tried a custom Loop hybrid but that failed to do uncoordinated indices between collection and loop.

All I want to do is increment a count within the template and act on it when it reaches a certain value and then reset it.

IE. render <TR> tag every 3 iterations of my outer For loop.

Does this exist in Tapestry?

Best regards
Ken in nashua
_________________________________________________________________
Climb to the top of the charts! Play Star Shuffle: the word scramble challenge with star power. http://club.live.com/star_shuffle.aspx? icid=starshuffle_wlmailtextlink_oct


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to