Skip to Content

How to populate Generic Tiles dynamically with data from Backend?

Hello SAPUI5 people,

I want to populate generic tiles with data from backend using odata service, can anyone guide me how to do this?

I am a beginner so do not have any idea about populating tiles with data coming from backend.

Thank you,

Regards,

Chetna

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Mar 18, 2015 at 10:14 AM

    copy paste this code in the createcontent method.

      var oModel = new sap.ui.model.odata.ODataModel("proxy/http/services.odata.org/V3/(S(hwii2w0uoa1wgczn3bian230))/OData/OData.svc/");
      oModel.oHeaders = {
      "DataServiceVersion" : "3.0",                   // first check the oModel data version, since we are using data version 3 in the 
      // in the service URL that we are accessing, we set out oModel version from 2 to 3
      "MaxDataServiceVersion":  "3.0" // if not we get an error
      };
    
      sap.ui.getCore().setModel(oModel);
    
    
    
       var tileContainer = new sap.m.TileContainer("tileid",{
         height: '300px',
         tiles : [
           new sap.m.CustomTile({
             content: new sap.m.Text({text: 'Sample example'})
           })
         ]
       });
    
    
      // var tile = sap.ui.getCore().byId("tileid");
       tileContainer.setModel(oModel);
       
       var template = new sap.m.StandardTile({
         title : "{Name}"
       });
       
       
       tileContainer.bindAggregation(
         'tiles',
         '/Products',template
         
         
       );
       
       
       
       tileContainer.placeAt('content');
    
    
    
    
    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      sap.ui.jsview("test1.abc", {

      getControllerName : function() {

      return "test1.abc";

      },

      createContent : function(oController) {

      var oModel = new sap.ui.model.json.JSONModel(" ", false);

      sap.ui.getCore().setModel(oModel);

      var tileContainer = new sap.m.TileContainer("ID",{

      height: '300px',

      tiles : [

      new sap.m.CustomTile({

      content: new sap.m.Text({text: 'Sample example'})

      })

      ]

      });

      // var tile = sap.ui.getCore().byId("tileid");

      tileContainer.setModel(oModel);

      var template = new sap.m.StandardTile({

      title : "{TILE_NAME}"

      });

      tileContainer.bindAggregation(

      'tiles',

      '/UserSet',template

      );

      tileContainer.placeAt('content');

      }

      });

      Why this is not working???

  • Posted on Mar 18, 2015 at 09:33 AM
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.