it would be easier to give you an advice if you'd outline the problem
you are having a little more.
but if you ask me i'd put a delegate inside the loop and let the "to"
binding decide what component/block to render. i use this approach to
render a list of "item" (types) that may have completely different
representations.
<t:loop t:source="selectedModule.settings" t:value="currentSetting"
t:index="index">
<t:delegate to="decide" />
</t:loop>
<t:block>
<div t:id="evenRowComp" />
<div t:id="otherComp" />
</t:block>
as always it depends on what you wanna achieve
g,
kris
On Wed, Jul 4, 2012 at 10:04 PM, bhorvat <[email protected]> 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: [email protected]
> For additional commands, e-mail: [email protected]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]