Currently you only have these options:
There is a ‘planned’ Idea for conditional classes though: https://forum.mendix.com/link/ideas/512
There is a possibility in datagrids to style based on attribute as the attribute is part of the dom node attributes. But that does not help in your case.
use the Enum Class widget => https://appstore.home.mendix.com/link/app/2641/First-Consulting/EnumClass
Hope it will be helpful!
Well the first option is used a lot. This however indeed has it's downside's, espacially when you do this a lot on big pages.
An other option would be to use a widget like the css selector helper: https://appstore.home.mendix.com/link/app/35039/
Thanks for your responses.
I couldn’t get EnumClass to work, although it looked promising and very flexible.
Found out about Dynamic Classes as a possible solution in the idea thread mentioned by Fabian (https://forum.mendix.com/link/ideas/512) , which worked and was easy to use. The only downside is that the class can only be applied to the parent, although that was I wanted anyway.