Skip to Content
Apr 28, 2016 at 01:11 PM

Dynamic Tiles using Odata


Hi All,

I have a requirement in which I need to create dynamic tiles based on Odata. I have acheived the same.

Now I have another requirement where in I need change the background color of the tiles based on content in the tile. I am trying to access the content of the tilecontainer and trying to add the style class for each tile, however my Tilecontainer is shown as empty although I can see the tiles on my page.

Below is the code

var tileContainer = new sap.m.TileContainer("tileContainer",{
   allowAdd : true,
   editable : false

      var templateTile = new sap.m.StandardTile({
       title : '{COUNT}',
      oModel = sap.ui.getCore().getModel();

  tileContainer.bindAggregation("tiles",{path : "/Orders", filters: [f1, f2], template: templateTile});

  new sap.m.App({
           pages : new sap.m.Page({
             enableScrolling : false,
             content : [tileContainer]

// Below code is for accessing the tiles in the TileContainer and adding style class to them
var tiles = tileContainer.getTiles(); if (tiles != null){ for ( i = 0; i < tiles.length; i++){ if(tiles[i].getTitle = "CANCELLED"){ tiles[i].addStyleClass("test"); } } }