Sure you have an access to the index, just like to the element itself.
Read the documentation. I'd just do all of that logic in the page
class and implement something like getStyleClass().

I don't agree with your "it would be nice if simple loops like this
could be achieved in TML" statement. Having gone through the jsp hell
where designers pretend to be programmers, I much prefer keeping most
of the logic in Java - this goes back to what I said in the other
thread you had started.

Kalle


On Thu, Sep 24, 2009 at 10:23 AM, Gunnar Eketrapp
<gunnar.eketr...@gmail.com> wrote:
> Hi!
>
> It's not that simple ...
>
> The level is displayd as (idx+1) and i dont even have acess to the index or
> do I?
>
> The class="tdalt" that is rendered on each second line can be solved by
> methods.
>
> But I haven't come up with a solution for the index and index+1 problem.
>
> Or am I stupid? Perhaps there is something that I have not grasped ...
>
> I am quite new to T5 ...
>
> I gave up and solved it with a method + outputRaw. I also made a component
> for some other case.
>
> But it would be nice if simple loops like this could be achieved in TML.
>
> Gunnar
>
>
> 2009/9/24 kalle.o.korhonen <kalle.o.korho...@gmail.com>
>
>> You can just use Loop component -
>>
>> http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Loop.html
>>
>> Kalle
>>
>> On Thu, Sep 24, 2009 at 5:31 AM, Gunnar Eketrapp
>> <gunnar.eketr...@gmail.com> wrote:
>> > I am converting jsp that produces a table like ...
>> >
>> > 1      317
>> > 2      45
>> > 3      118
>> >
>> > ... i,e. an index plus a count for that index.
>> >
>> > How should you folks do this? Is there a way with .tml to fix this or do
>> I
>> > have to use Grid or write a component.
>> >
>> > JSP code
>> > =======
>> > <% int level=1; %>
>> > <c:forEach items="${levels}" var="count">
>> > <tr>
>> > <td<%= level % 2 == 0 ? " class=\"tdalt\"" : "" %>><%= level %></td>
>> > <td<%= level % 2 == 0 ? " class=\"tdalt\"" : "" %>>${count}</td>
>> > </tr>
>> > <% ++level; %></c:forEach>
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>>
>
>
> --
> [Hem: 08-715 59 57, Mobil: 0708-52 62 90]
> Allévägen 2A, 132 42 Saltsjö-Boo
>

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

Reply via email to