Change code to,

public boolean isEvenColumn () {
    return index % 2 == 0;
}


<t:loop index="index" source="list" value="element">
    <t:if test="evenColumn">
        <tr class="even">
        <t:parameter name="else">
            <tr class="odd">
        </t:parameter>
    </t:if>
    </tr>
</t:loop>


Thanks
Stony


-----Original Message-----
From: John Doe [mailto:nicu4...@yahoo.com] 
Sent: Tuesday, September 14, 2010 4:28 PM
To: Tapestry users
Subject: Re: Alternating table rows

Yes, I could do that, but that would mean putting CSS in Java classes and I 
would prefer avoiding that.

Does Tapestry 5 have any support for conditions like "index % 2 == 0" in 
templates?




________________________________
From: Stephan Windmüller <stephan.windmuel...@tu-dortmund.de>
To: users@tapestry.apache.org
Sent: Tue, September 14, 2010 11:17:03 AM
Subject: Re: Alternating table rows

On 14.09.2010 10:01, John Doe wrote:

> How can I make the alternating rows?

Use the following code:

private boolean switch;

public String getSwitchedClass() {
    switch = !switch;

    return switch ? "odd" : "even";
}

And in the tml:

<tr class="${switchedClass}">

HTH
Stephan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org


      



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to