cancel
Showing results for 
Search instead for 
Did you mean: 

How to hilight a Tile in SAPUI5 on Page load (not on any press event)

former_member243729
Participant
0 Kudos
1,039

Hi,

Have a requirement to highlight a tile (Generic Tile) based on a value in the model at run time (on load of the page and not on any press event). I know we can use CSS file to highlight the tile which I am able to do on press event but how to invoke a javascript function on load of this GenericTile and then add CSS class to it,..is what I am not getting. Below is what I have..

<GenericTile>

<tileContent>

<TileContent>

<Linktext="{path: 'oModel>Description'}"></Link>

</TileContent>

</tileContent>

</GenericTile>

View Entire Topic
former_member243729
Participant
0 Kudos

I could achieve this using below code.

this.getView().byId("idTile").addEventDelegate({
 onAfterRendering : function (oEvent) 
  {
var oModel = oEvent.srcControl.getAggregation('content').oPropagatedProperties.oBindingContexts.TempModel;
var sPath = oModel.sPath;

    if(oModel.getProperty(sPath).DefaultFlag)
       oEvent.srcControl.addStyleClass("selected");
  }
});