Row coloring in a table view is driving me crazy. This used to be easy with the old rowbackground calcs. Now, I'm just trying to color the background of a label based on the day of the week contained in another field using onRender . It works when the field is rendered, but it colors all the fields in every table row the same color until you move to a different day and then it changes all the rows to that color.
I have a pretty simple function using the value in the "day_name" field to determine the background color.
- Code: Select all
function onShow_row_color(event) {
if ( day_name == "Mon"){
elements.row_color.bgcolor = "#D4D4FF";
}
else
if ( day_name == "Tue"){
elements.row_color.bgcolor = "#D1FFFF";
}
else
if ( day_name == "Wed"){
elements.row_color.bgcolor = "#C1FFC2";
}
else
if ( day_name == "Thu"){
elements.row_color.bgcolor = "#FFFFD4";
}
else
if ( day_name == "Fri"){
elements.row_color.bgcolor = "#FFE0C1";
}
else
if ( day_name == "Sat"){
elements.row_color.bgcolor = "#FFD4D4";
}
else
if ( day_name == "Sun"){
elements.row_color.bgcolor = "#DDC1AD";
}
else
{
elements.row_color.bgcolor = "#FFFFFF";
}
}