Hello there If the change you want to apply to those elements is purely visual, I would suggest the :nth-child(even) pseudo selector [1].
On the other hand, if you still want to apply that particular class to the div, I would suggest this approach: <t:loop t:source="selectedModule.settings" t:value="currentSetting" t:index="index"> <div class="${divClass}"></div> </t:loop> You return the wanted class in the getDivClass() method. [1] http://www.w3.org/TR/css3-selectors/#nth-child-pseudo On Wed, Jul 4, 2012 at 10:04 PM, bhorvat <horvat.z.bo...@gmail.com> wrote: > So here is the annoying problem, I have a loop and I need to make every > even > rows different then odd rows. So the way I do this is I have a index and a > methods isEvenRow that returns if the row is even. Then based on that I > have > one if withe else section. The only difference between content of both is > in > one single tiny class called itrEven. > > <t:loop t:source="selectedModule.settings" t:value="currentSetting" > t:index="index"> > <t:if test="evenRow"> > <div class="itRow <b>itrEven*"></div> > <p:else> > <div class="itRow"></div> > </p:else> > </t:if> > </t:loop> > > So how do I make this less verbose. I dont like the fact that I need to > have > one extra field and methos in the page, as well as having the duplication > of > the html code (there is a lot of code in between if else section I have > just > removed it since it is not important) > > Is there a better solution? > > And yes I know that I am being pedantic about this, but it is really > annoying :) > > -- > View this message in context: > http://tapestry.1045711.n5.nabble.com/How-to-have-every-second-value-in-the-t-loop-different-tp5714278.html > Sent from the Tapestry - User mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >