HTML5 Data Bindings Formatter Support Product Page
Answered
Changing a class based on two values ....
Asked 04 Feb 2016 18:25:34
1
has this question
04 Feb 2016 18:25:34 Brad Lawryk posted:
I have a case where I need to change the class of a span tag to red text if the data value is 'Incomplete', green text if the data value is 'Complete', if neither then it should be grey text. I can get it to change to red no problem but then as soon as I add a second check it always defaults to the grey.In the sample below I have the red text working and defaulting to green for now. How would I add the second value check?
I have:
<span class="{{wsClientWSOutcome.startsWith( "Inc" ).then( "redText", "greenText" )}}">{{wsClientWSOutcome}}</span>
Replies
Replied 08 Feb 2016 09:34:49
08 Feb 2016 09:34:49 Teodor Kuduschiev replied:
Hello Brad,
Second condition code should look like:
<span class="{{wsClientWSOutcome.startsWith( "Inc" ).then( "redText", "" )}}{{wsClientWSOutcome.startsWith( "Comp" ).then( "greenText", "" )}}">{{wsClientWSOutcome}}</span>
Second condition code should look like:
<span class="{{wsClientWSOutcome.startsWith( "Inc" ).then( "redText", "" )}}{{wsClientWSOutcome.startsWith( "Comp" ).then( "greenText", "" )}}">{{wsClientWSOutcome}}</span>