Hi,
I know this is probally a simple one, but I would like to change the backround colour of fields in list view. I have used the following code successfully to change text colors, but backround colours would be better.
var c = '#00000' // black
if (myImportantField == myCriteria )
{
c = '#FF000'; // red
}
return '<html><font color="' + c + '">' + myImportantValue + '</font></html>';
Place that in a calculation and use a label or field with displayType set to HTML_AREA to display this and you are set.
Hi Robert,
Many thanks that works a treat, if I do not want to include the “myImportantValue” how do I take this out ? In other words I do not want to show any text at all. Just the coloured feild.
prj311:
Hi Robert,
Many thanks that works a treat, if I do not want to include the “myImportantValue” how do I take this out ? In other words I do not want to show any text at all. Just the coloured feild.
Use the HTML placemark " " instead of "myImportantValue to render an empty table cell.
Hi,
Could I ask how to set the TD height as well, as the shape of my coloured boxes seem to be changing height when I select the record or click on them. Once again thank you in advance
And in some situations you might want to set the height property of the TD tag as well.
prj311:
Hi,
Could I ask how to set the TD height as well, as the shape of my coloured boxes seem to be changing height when I select the record or click on them. Once again thank you in advance
And in some situations you might want to set the height property of the TD tag as well.
The height can be set using the “height” property like this
return '<html><table width="100%"><tr bgcolor="' + c + '"><td height="25"> </td></tr><table></html>';