I'm posting to share the following code that Support gave to me that alternates the row colors of "batches" of rows.
Use the following in an HTML snippet in a page.
(Personally, I prefer to concatenate all of my HTML in an HTML variable then showing that, rather than alternating back and forth from Deluge to HTML).
- <%{
- lst1 = {"red","green","blue","white","green"};
- lst2 = {1,2,3,4,5};
- %>
- <table border='black 1px' style="width:100%">
- <%
- // x is a counter for the outer loop lst1, and will alter clr below when lst1 changes to another value
- x = 0;
- for each r1 in lst1
- {
- x = x + 1;
- // the % (modulus) divides the left hand by the right hand and returns a remainder, b % a = 0
- // i.e. if x is odd (e.g. 1, 3, 5), there will be a remainder, hence NOT == 0, so paint the row violet
- // if x is even (2, 4, 6) there will NOT be a remainder, hence == 0, so paint the row orange
- clr = if(x % 2 == 0, "orange", "violet");
- // the "batches" of rows / records that belong to each element in lst1
- for each r2 in lst2
- {
- %>
- <tr style="background-color:<%=clr%>">
- <td><%=r1%></td>
- <td><%=r2%></td>
- </tr>
- <%
- }
- }
- %>
- </table>
- <%
- }%>