This topic is locked

Change colour of row in list view based on field value

1/11/2007 7:51:21 AM
PHPRunner General questions
N
Norian author

Hello,
I am currently working on trying to adapt the list view so that the row changes colour depending on a specific field value. I am trying to get it so that if one field is set to Yes then in the list view that row will be different colour to stand out, this could be the colouring on the row or text.
Any help would be greatly appreciated.
Many thanks. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=4356&image=1&table=forumtopics' class='bbc_emoticon' alt=':D' />

J
Jane 1/11/2007

Norian,
you can do the following:

  1. proceed to the Visual Editor tab, turn on HTML mode, click on one of your fields, find this line:
    <TD>{$row.1FieldName_value} </TD>

and replace it with this one:

<TD {if $row.1SpecificFieldName_value=="Yes"}bgcolor=yellow{/if}>{$row.1FieldName_value} </TD>



where SpecificFieldName and Fieldname are your actual field names.

2. make the same for all your fields on the list page.

N
Norian author 1/12/2007

Norian,

you can do the following:

  1. proceed to the Visual Editor tab, turn on HTML mode, click on one of your fields, find this line:

    and replace it with this one:

    where SpecificFieldName and Fieldname are your actual field names.
  2. make the same for all your fields on the list page.


Hello Jane,
thank you that worked just as expected. Is this also possible with an if and sort of statement, so if call back = yes and dealt with = no then bg color red??
Many thanks.

Sergey Kornilov admin 1/12/2007

Something like this should work:

<TD {if $row.1Callback_value=="Yes" && $row.1Dealtwith_value=="No"}bgcolor=yellow{/if}>{$row.1FieldName_value} </TD>
K
Keith 1/13/2007

Rather than use the <TD {if ....}bgcolor=yellow{/if}> you might use the CSS class statement and control it in the CSS style file.

<td {if .... }class="dohighlite"{/if}>
then in the style.css file add a .dohighlite {background: yellow;} statement. If you then decide other graphics are also desired (like text color), they're easy to add to the class.
-Keith