Hello.
I have a list that has a calc element that occasionally has a negative number value in it. I'd like this element's font to change to red if the value is negative. I thought this would be easy; as I'm changing both background colors and font colors of rows in a list based on 1 or more elements in the list. I've been trying to make this work for a couple of days; but now I give up and I'm looking for help. I thought I was close when I read and tried to implement a custom template of default_row.php and custom_css.php; per the following threads:
http://fabrikar.com/forums/index.php?threads/color-code-element-based-on-reference-range.25561/
http://fabrikar.com/forums/index.php?threads/notice-undefined-variable-row.38717/#post-194476
Below is what I have so far in default_row.php:
Below is what I have so far in custom_css.php:
Unfortunately, the negative values in this element stays black. Please help, anyone. Thanks in advance.
I have a list that has a calc element that occasionally has a negative number value in it. I'd like this element's font to change to red if the value is negative. I thought this would be easy; as I'm changing both background colors and font colors of rows in a list based on 1 or more elements in the list. I've been trying to make this work for a couple of days; but now I give up and I'm looking for help. I thought I was close when I read and tried to implement a custom template of default_row.php and custom_css.php; per the following threads:
http://fabrikar.com/forums/index.php?threads/color-code-element-based-on-reference-range.25561/
http://fabrikar.com/forums/index.php?threads/notice-undefined-variable-row.38717/#post-194476
Below is what I have so far in default_row.php:
Code:
<tr id="<?php echo $this->_row->id;?>" class="<?php echo $this->_row->class;?>">
<?php foreach ($this->headings as $heading => $label) {
$extra_class = "";
if ($heading == 'bw_projects___bidlaborhoursremaining') {
if ($row->_data->bw_projects___bidlaborhoursremaining_raw < 0) {
$extra_class = "lessthanzero";
}
else {
$extra_class = "zeroormore";
}
}
$style = empty($this->cellClass[$heading]['style']) ? '' : 'style="'.$this->cellClass[$heading]['style'].'"';
?>
<td class="<?php echo $extra_class . ' ' . $this->cellClass[$heading]['class']?>" <?php echo $style?>>
<?php echo @$this->_row->data->$heading;?>
</td>
Below is what I have so far in custom_css.php:
Code:
.lessthanzero {
color:red;
}
.zeroormore {
color:black;
}
Unfortunately, the negative values in this element stays black. Please help, anyone. Thanks in advance.