Re: How to generate a table row twice over the same range of items
Re: How to generate a table row twice over the same range of items
- Subject: Re: How to generate a table row twice over the same range of items
- From: John Clayton <email@hidden>
- Date: Sat, 26 Mar 2005 16:17:06 -0500
Ah yes, it makes sense now ...
Thanks!
On Mar 26, 2005, at 3:17 PM, David LeBer wrote:
On Mar 26, 2005, at 2:58 PM, John Clayton wrote:
Well, here's a more detailed explanation, and please tell me if this
is the completely wrong approach:
My pseudo markup looks like this:
<table>
<tr>
<webobject name="MyItemsRepetition">
<td>thisItem.img</td>
<webobject name="NewRowAfterFiveCellsCondition">
</tr><tr>
<!-- Here's where I need to loop over same five items as above to
create a new row-->
<webobject name="MyItemsRepetitionRowTwo">
<td>thisItem.someOtherProp</td>
<!-- stop after five! -->
</tr><tr>
</webobject
</webobject>
</webobject>
</tr>
</table>
Where the output I'm hoping for is like this:
<table>
<tr>
<td>items[0].img</td>
<td>items[1].img</td>
<td>items[2].img</td>
<td>items[3].img</td>
<td>items[4].img</td>
</tr>
<tr>
<td>items[0].someOtherProp</td>
<td>items[1].someOtherProp</td>
<td>items[2].someOtherProp</td>
<td>items[3].someOtherProp</td>
<td>items[4].someOtherProp</td>
</tr>
<tr>
<td>items[5].img</td>
<td>items[6].img</td>
<td>items[7].img</td>
<td>items[8].img</td>
<td>items[9].img</td>
</tr>
<tr>
<td>items[5].someOtherProp</td>
<td>items[6].someOtherProp</td>
<td>items[7].someOtherProp</td>
<td>items[8].someOtherProp</td>
<td>items[9].someOtherProp</td>
</tr>
</table>
It looks like you will need multiple repetitions (or more elegantly, a
repetition around a pair of repetitions at least) to achieve what you
want.
Take a look at using the WOReptetition count and index bindings
instead of the list and item bindings.
Then put logic in your WOComponent to figure out which item should
appear in that row of the WOReptetition(s). Perhaps something like:
public repetitionItem() {
return items().objectAtIndex(repetitionIndex + (batchIndex *5));
}
;david
--
David LeBer
Senior Systems Developer
PiMedia
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden