CSS class attribute data binding in XML view

How to associate a CSS class attribute value of an XML fragment with a model property in another XML view?

The following cut works are excellent

<core:Fragment fragmentName="com.foo.bar.Fragment" type="XML" class="important"/> 

and should be changed to something like

 <core:Fragment fragmentName="com.foo.bar.Fragment" type="XML" class="{itemStatus}"/> 

where {itemStatus} should be attached to the model property.

Any help appreciated!

+5
source share
1 answer

Unfortunately, it is really not possible to bind a class attribute, as already mentioned in Qualdition. However, there is a workaround using user data that can be linked, written to the DOM, and therefore also used for styling. You can see an example in the documentation: Writing data in HTML DOM as attribute DATA- *

Hope that helps

+10
source

Source: https://habr.com/ru/post/1210674/


All Articles