Apply css and events on table row
272
Views
3
Comments
New
Service Studio

It is only possible to assign fixed-style classes to table rows, not dynamic ones, based on the row value. It would be beneficial to have the ability to add classes and events to a row based on an expression. This way, we can apply styling and events to an entire row instead of every cell, reducing duplicate code.



I agree.  But there are workarounds :

for events: see my forge asset

for css : set a dynamic class in "Style Classes" property of any of the cells, and have rules like

.table-row:has(.cellclass) td { 

... your styling here ...

}


Dorine

Hi @Dorine Boudry 

I'm aware of the workaround, but thank you for sharing it. 

For the events, I will share your component with my team. 

Ah ok,

i assumed, because you said "...instead of every cell, reducing duplicate code..." that you hadn't come up yet with the :has selector to avoid duplication of logic