Set colour for row in table/Grid

What is the best way to set the colour of a table row, depending on the content of a specific cell?

For example:
I have a table with the columns ID, Name, Date and depending on the Date the whole row should be coloured red if Date > today+1day, yellow if Date is today and otherwise not.

How can I do this?

check this for solution in agile ui demo
two extra css class required .tomorrow and .today and use to the column definition the addClass(‘today’) member function switch to source view top of page I hope help it for you

Hello Janos,

I found this demo, but I don’t want to colour the whole column as in the example:

$table->addColumn('surname', new \atk4\ui\TableColumn\Template('{$surname}'))->addClass('warning');

I need to colour the whole row…
and how can I implement different css-classes depending on the content of one cell of the row??

Maybe jQuery could be used, and/or the addHook(‘beforeRow’) (or afterRow) function?

I hope this will help it is a hack only but working Not a classic solution

1 Like

Thank you so very much! You were an absolut lifesaver and it is working like a charme!!!

You literally saved my life :wink: