Reputation: 7438
I want to bind a value to the value of a Text control with condition.
For eg: my json is
[{
"name": "XXXXX",
"active": false
}, {
"name": "YYYY",
"active": true
}]
MyFile.view.xml
<tbl:Table id="details">
<tbl:Column width="11rem">
<Label text="Name" />
<tbl:template>
<Text text="{name}"/>
</tbl:template>
</tbl:Column>
<tbl:Column width="11rem">
<Label text="Status" />
<tbl:template>
<Text text="{active}"/>
</tbl:template>
</tbl:Column>
</tbl:Table>
Here i'm getting UI as Table
Name Status
XXXX false
YYYY true
But I want to show output as below
Name Status
XXXX InActive
YYYY Active
How can achieve this?
Upvotes: 0
Views: 1166
Reputation: 4232
You can either use a formatter or expression binding. Expression binding would look like this:
<Text text="{= ${active} === true ? 'Active' : 'Inactive'}"/>
Upvotes: 1