Coloured Cells in Table View (JavaScript) on the webportal

#1

Hi All,

I’ve got a Table View (JavaScript) which is viewed via the KNIME WebPortal.

I would love to be able to colour cells in the table according to their value (e.g. Pass=Green, Fail=Red etc).

Does anyone know of a way to do this?

Thanks in advance!

Mike

0 Likes

#2

Hi Mike,

there is no direct way to change the background colour of a cell, however the cell contents of the table can be rendered as HTML and so you could change the column to contain for example a div with a green background color and the text in it. You can use a String Manipulation for that for example.
You might then also want to remove the padding of the cells, which you can do with custom CSS as explained here https://www.knime.com/css-styling

Hope this helps,
Christian

2 Likes

How to color each cell in Table View (JS) based on its content?
#3

Hi Christian,

I hope you are well and still running regularly! Many thanks for your advice below which I’ll look into (as I’m new to both HTML tables and CSS styling).

Before I do though could I just check:
Will the HTML table on the WebPortal still have the same interactivity of the Table View (JavaScript)? I need the be able to select a specific row from the table to take forward to the next stage of analysis ultimately resulting in another table (actually the workflow involves multiple tables in succession which allow the user to delve deeper into the analysis about their research).

Thanks again for your help,

Regards,

Mike.

0 Likes