6

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!

z00bs
  • 7,518
  • 4
  • 34
  • 53

1 Answers1

11

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

Inizio
  • 2,226
  • 15
  • 18
10littleOrcs
  • 151
  • 1
  • 6