21490 Posts in 5783 Topics by 2622 members
General Questions
SilverStripe Forums » General Questions » Accessing Pos & EvenOdd of a DataObjectSet that is a parent of the current DataObjectSet
General questions about getting started with SilverStripe that don't fit in any of the categories above.
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 892 Views |
-
Accessing Pos & EvenOdd of a DataObjectSet that is a parent of the current DataObjectSet

16 February 2010 at 12:48am
So this is the structure I have.
<% control StoreProducts %>
<% if Variants %>
<tr class="$EvenOdd"> // Shows what I want it to
<td><h4>$Title</h4></td>
</tr>
<tr class="<% if totalVariantsForTable == 2 %>last <% end_if %>first $EvenOdd"> // Shows what I want it to
<% control Variants %>
<% if Active %>
<% if First %><% else %>
<tr class="$FirstLast $EvenOdd"> // What do I do here?
<% end_if %>
<td>$Name</td>
</tr>
<% end_if %>
<% end_control %>
<% end_if %>
<% end_control %>So basically I'm trying to get EvenOdd's that are all the same, so basically the EvenOdd value of the StoreProducts DataObjectSet. How would I access StoreProducts when its inside a control (and a couple if's)?
I thought $Top would be the answer, but not to be. Any thoughts guys?
-
Re: Accessing Pos & EvenOdd of a DataObjectSet that is a parent of the current DataObjectSet

16 February 2010 at 5:50am
I had exactly this problem too - and unfortunately it isn't straightforward to solve. There is currently no way to access that parent without breaking the loop, so I came up with a patch for SSViewer that gave you a new <% parent %> tag. See http://open.silverstripe.org/ticket/4751 for info and a patch you can apply.
-
Re: Accessing Pos & EvenOdd of a DataObjectSet that is a parent of the current DataObjectSet

16 February 2010 at 12:21pm
That worked great, thanks Hamish
| 892 Views | ||
|
Page:
1
|
Go to Top |


