Datagrid template

Hi,

I have a database table with records which have a field (NoteDisplayColour) which contains a Hex colour code. This is shown in the DataGrid component. Is it possible to change the colour (background or text) of the column showing the colour code to actually display using the colour in the Hex field?

I've tried using this template but, it doesn't seem to like using expressions within inline styles:

<span style="color: ${data.NoteDisplayColour};">
    ${data.NoteDisplayColour}
</span>

I've sorted this one myself...Angular Dynamic binding seems to work:

image

Just a small correction - the Angular syntax should be:

<span [style.color]="data.NoteDisplayColour">
</span>

Didn't know that "this.data.NoteDisplayColour" would work.

2 Likes

Thanks for the correction :slight_smile:

Can you please show me where you would put this angular syntax. Many thanks

This code can be used as column template.

I am already using the column template with the following code, is there a way to combine the background colour as well?

<p style="white-space:pre-wrap">${data.JobNo}</p>

Yes, you can add binding for the backgroundColor similar to the example in this thread.