How to add multiple dynamic classes

0
Hi,  As we know , we have dynamic classes option to have a class based on some expression.  i need to add 2 or more dynamic classes for an item like popup menu, text etc. I will apply some css stuffs based on that class. so anyone know how to add multiple dynamic classes.
asked
3 answers
2

If you want to add multiple classes to the already created expression, you just have to add a space between the classes. For example:

if $dataView1/IsLive = true then 'restrict-simulation-click class-two' else ''

If you want to add more if/else expressions, you can add else if. For example: 

if $dataView1/IsLive = true then 'restrict-simulation-click' 
else if $dataView1/IsLive = false 'class-name'
else ''

 

answered
2

When you have multiple possible combinations for classes, the if then else if statements can become complex. We have solved this by doing it like this:
 

(if  $currentObject/IsGeselecteerd
	then 'geselecteerd '
		else ''
)
+
(if $currentObject/IsGemarkeerd
	then 'gemarkeerd '
		else ''
)
+
(if $currentObject/IsActief
	then 'actief '
            else ''
)

Don't forget to put an extra space after the name of the class, to make sure they result in separate classes. The extra space at the end of the resulting string does not seem to be problem.

answered
0

Hi, 

Take a look at Dynamic class widget where a microflow/nanoflow can be called and string(class) can be returned

https://marketplace.mendix.com/link/component/108838

Hope it helps!!!

answered