XML视图中CSS类属性的数据绑定 [英] Data binding of CSS class attribute in XML view
问题描述
如何将XML片段的CSS类属性的值绑定到另一个XML视图中的模型属性?
How can I bind the value of the CSS class attribute of a XML fragment to a model property within another XML view?
以下剪辑工作正常
<core:Fragment fragmentName="com.foo.bar.Fragment" type="XML" class="important"/>
,应更改为
<core:Fragment fragmentName="com.foo.bar.Fragment" type="XML" class="{itemStatus}"/>
其中 {itemStatus}
应该绑定到模型属性。
where {itemStatus}
should be bound to model property.
任何帮助赞赏!
推荐答案
不幸的是确实不可能绑定类属性,正如已经提到的。
但是,有一个解决方法使用自定义数据,可以绑定,写入DOM,因此也用于样式目的。
您可以在文档中看到一个示例:
https:// openui5 .hana.ondemand.com /#docs / guide / 1ef9fefa2a574735957dcf52502ab8d0.html
unfortunately, it is indeed not possible to bind the class attribute, as Qualiture already mentioned. However, there is a workaround using custom data, which can be bound, written to the DOM and hence also used for styling purposes. You can see an example here in the documentation: https://openui5.hana.ondemand.com/#docs/guide/1ef9fefa2a574735957dcf52502ab8d0.html
希望有帮助!
最佳,
10littleOrcs
Best, 10littleOrcs
这篇关于XML视图中CSS类属性的数据绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!