Table Text Color

I am trying to dynamically change the color of text in a table based on a different column’s value in the same row.

If I render the cell as pure HTML, then this works for just changing the color:
<p style ="color:#9E9E9E">{{self}}</p>

However, when I try and use a ternary operator to combine both currentRow and self it does not seem to work.
{{currentRow['value1'] == null ? '<h1>{{self}}</h1>' : 'New Value'}}

This throws an invalid token error due to the closing brackets of the {{self}} value.

Anyone got ideas on what I am doing wrong or what else I could do? Maybe I could use a transformer in some manner?

Hey @DakotaB you should be able to remove the {{}} around self change it to a template literal and it will work!

Example:

{{currentRow['value1'] == null ? `<h1 style="color:#32a852">${self}</h1>` : 'New Value'}}
2 Likes