Michu93
Michu93

Reputation: 5745

Title depending on other variable in SAPUI5

Sometimes when I want to show something and hide other thing I just do: visible={some_variable} for example <Column visible={some_variable}>. Now I have to deal with Dialog title I mean: I would like to do something depending on other variable - if variable is a then title="{i18n>a}" and if variable is b then title="{i18n>b}". How can I do that?

Upvotes: 0

Views: 416

Answers (1)

Jorg
Jorg

Reputation: 7250

The ternary operator works in sapui5 bindings. So in this case, you could do:

<Dialog title="{= ${variable} === 'A' ? ${i18n>a} : ${i18n>b} }" />

If it gets more complicated, a formatter might be a better solution.

Upvotes: 2

Related Questions