Skip to main content
Topic: How do I change the color of the cell based on it's contents? (Read 3448 times) previous topic - next topic

How do I change the color of the cell based on it's contents?

I have the following in my table status = pending or completed.

In list view, if it's completed I want row or cell #FFA07A.
If it's pending I want the row or cell #AFEBA3.

Evaluating PHPRad Classic 2.6.0 | Have licenses for other PHP generators.

Re: How do I change the color of the cell based on it's contents?

Reply #1
You can use the Custom Field Option on the Field Display Style



Re: How do I change the color of the cell based on it's contents?

Reply #2
That works, but it takes away inline editing for that field and only highlights the word instead of the cell, which isn't a big deal for me.
Evaluating PHPRad Classic 2.6.0 | Have licenses for other PHP generators.


 

Re: How do I change the color of the cell based on it's contents?

Reply #4
Hello all,
I am new to PHPRAD.

I have a Status column and trying to change its color based on the value. Trying the above solutions but I get a weird error. I am setting its display type as Custom and then using this code to change the color

Code: [Select]
<?php
    if($data['Status'] = 'Completed'){
        ?>
        <span class="badge badge-success"><?php echo $data['Status'] ?></span>
        <?php
    }
    else{
        ?>
        <span class="badge badge-danger"><?php echo $data['Status'] ?></span>
        <?php
    }
    ?>

When I preview the list, the Status field on all records get the value "Completed" or whatever I set on the first clause of if statement

Any help is welcome

Thanks
George