Below is a fragment of UI5. I have assigned a class="myGreen" is a custom css style I created. I am able to get all the tiles are green which is good. But I wanted to send different styles for each Tile. Like myRed or myYellow. If I try to send these class names through JSON , the tile color does not change. I passed it in the tag {myModel1>className}. How can we read a tile from the fragment and change its color if the below method is not possible ?
<StandardTile
icon="{myModel1>icon}"
number="{myModel1>number}"
info="{myModel1>info}"
infoState="{myModel1>infostate}"
title="{myModel1>title}"
numberUnit="{myModel1>numberunit}"
press="handleTilePress"
class="{myModel1>className}"/>
Code without JSON sending the Class name is below:
<core:FragmentDefinition xmlns="sap.m"
xmlns:f="sap.ui.layout.form" xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc"
xmlns:html="http://www.w3.org/1999/xhtml" xmlns:l="sap.ui.layout">
<Page id="tileInfo" showHeader="false" enableScrolling="true" >
<TileContainer
id="getTiles"
tiles="{myModel1>TILECOLLECTION}">
<StandardTile
icon="{myModel1>icon}"
number="{myModel1>number}"
info="{myModel1>info}"
infoState="{myModel1>infostate}"
title="{myModel1>title}"
numberUnit="{myModel1>numberunit}"
press="handleTilePress"
class="myGreen"
/>
</TileContainer>
</Page>
</core:FragmentDefinition>