I would like to colour each cell of a table column on the base of some conditions.
The field of interest is a date; I have three conditions and so three possible colours to assign.
I want to assign one of the three colours to the cell of the table according to the verified condition.
Ex. Red if rowdata> date()
Orange if rowdate is 5 days before today date.
Green if rowdate is more than 5 days with respect to the today date.
My first option is to colour the field 'Data Scadenza' according to some conditions.
If this is not possible, I can add the column Colour Status and colour this cell according to the conditions that must be verified.
It is best, when looking for help in the forum, to be explicit as to what node you are using. There are thousands and it can be hard for people to know.
The information on that node tells you what you need in order to be able to style it further.
Thanks for suggestion.
I have already found this link, but I was looking for somenthing more practical, some specific example on how to insert a conditional formatting on the column data according to some conditions.
Look in the projects section of the forum for my ‘ETPhone home’ project. In it I change the color of cells based on data in one of the columns of the row.
Hi zenofmud,
I'm following your example for background colour, very useful.
In one column of my table, I put an expiration date.
I need to compare this date with respect to the today date. Is it possible to insert a condition based on a date?
(for example something similar to: if = x.DATASCADENZA < date() -> assign class="warning_green")
If I compare with an exact date I have seen that works (" td ng-if="x.DATASCADENZA ='2022-04-03' " class="warning_green" >{{x.DATASCADENZA}}"