Dynamic Class - paragraph

0
Hello everybody, I’m relatively new to Mendix. I want a paragraph in a list view entry to have a different colour depending on an enum value. For this, I use dynamic class, which looks as follows: if $currentObject/Score = MyFirstModule.Score.Good then 'text-success' else 'text-danger' It shows the right colour, but I only manage to render it as text, not as paragraph. I tried several changes, but nothing seems to be working. How can I render this dynamic class as paragraph? I don’t have any knowledge of writing CSS, so that is not an option. Thank you for your help!  
asked
3 answers
2

Hi Edward,

to change the color of your text without CSS, change the apparence of this one here :

When you change the color, the resulting class is here :

If you want to change it dynamically from your enum, you can reuse these classes. In the paragraphe “Dynamic class”


My enum look like :

In my exemple below, I change the color of my text, when his length is different.
Here my result :


Hope it serve you, regards,
Jérôme

answered
0

Hi Edward,

There’s a Render Mode selector in your text properties:

Setting that to “Paragraph” should render the text as a paragraph element with the dynamic classes you configured on top of it.

answered
0

it is throwing following error to me "unknown function getCaption"

 

This is my code.

if $currentObject/TempString1 = 'success' then getCaption(MainApp.Status.success)
else if $currentObject/TempString1 = 'warning' then getCaption(MainApp.Status.warning)
else getCaption(MainApp.Status.danger)

answered