Andrew Donnan
posted this on November 25, 2008 15:33
Use this example to create an alternate row background colors. This is sometimes referred to as zebra tables.
<eocrepeatallrecords>
<tr><attribute name="bgColor"><if test="position() mod 2 = 0">#dcdcdf</if><if test="position() mod 2 != 0">white</if></attribute>
<td style="FONT-WEIGHT: normal; FONT-SIZE: 10pt; FONT-STYLE: normal; FONT-FAMILY: Arial" selected="false" rowSpan="1" colSpan="1"><eocfield name="text1"></eocfield></td>
<td style="FONT-WEIGHT: normal; FONT-SIZE: 10pt; FONT-STYLE: normal; FONT-FAMILY: Arial" selected="false" rowSpan="1" colSpan="1" width=""><eocfield name="WO2_1_DT"></eocfield></td>
</tr>
</eocrepeatallrecords>
Comments
I cannot seem to get this snippet to work on my board? I also tried the other snippet that allows you to allocate a number of rows to change colour, is there any coding in need to change i.e 'test'
Is it possible to set the alternate row back ground colors to work on a display with that has sortable columns so when a user sorts by a column the records maintain the alternate row setting?
Just a note on how to get this to work (after I thought long an hard) - make sure each <tr> and <td> don't have individual bgColor attributes set.
two points for Drew!
Can I redeem those for development time?
I have consulted the Magic 8 Ball. Reply hazy, try again later.
Instead of using the deprecated "bgcolor" attribute, I'm styling my rows with a class. When using this method, if there was a class previously applied, it simply gets replaced with the new one (or removed depending on the case.) Is there a way to append to a particular attribute without invoking JavaScript?