How can I bind the value of the CSS class attribute of a XML fragment to a model property within another XML view?
The following snipped works fine
<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 bound to model property.
Any help appreciated!
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: Writing Data to the HTML DOM as DATA-* Attribute
Hope that helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With