Dynamic classes based on condition

0
Hi, Is there any way to apply css or classes dynamically based on condition. Also want to know how can we access html elements/ template refrence in microflows.  
asked
2 answers
2

Yes, you can do this by using XPATH’s declarations based on context. 

Go to widgets right section on Mendix, then chose the “Galery”

 

On gallery props, look for the field “Dinamic  Items Class”, and put your XPATH expression something like bellow

 

if $currentObject/Status = PainelCentral.StatusValues.Busy then ‘yourcsssclass'
else if $currentObject/Status = PainelCentral.StatusValues.Free then 'yourcssclass'
else 'not'
 

 

Then look for your _layout-atlas.scss file or other css file linked to your page and write your css classes there like this and test: 

.yourcsssclass{

display: none;

}

 

answered
1

Yes from Mendix 8.14 there is a new feature Dynamic Classes. 
Please see details here
https://www.mendix.com/blog/mendix-8-14-keep-the-maker-momentum-alive/
https://docs.mendix.com/refguide/common-widget-properties#dynamicclasses
 

answered