Title depending on other variable in SAPUI5

混江龙づ霸主 提交于 2019-12-25 00:04:39

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/53852469/title-depending-on-other-variable-in-sapui5

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!