Skip to Content

how to create tiles dynamically based on odata response data?

hi,

iam performing an odata read from controller of ,say login view and passing data to another view(dashboard) like below

OData.read({ requestUri:

  "url",

  headers: { "X-Requested-With": "XMLHttpRequest", "sap-user" : username, "sap-password" : password,  "Content-Type": "application/atom+xml" },

   },

   function (data) {

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

   var myData = {};

var jsonDashboard = {"mycollection":[]};

for(i = 0;i<data.results.length;i++){

//code for filling jsonDashboard array

}

myData.Products = data.results;

   myData.Dashboard = jsonDashboard.mycollection;

   oModel.setData(myData);

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

  //  sap.ui.getCore().setModel(oModel, "mydashboardModel");

   sap.ui.core.BusyIndicator.hide();

  //  sap.ui.getCore().getModel("mydashboardModel").updateBindings(true);

    app.to("Dashboard",data);

   },

 

   function(err){

  // window.alert("error: "+ err.message);

  // bsydialog.close();

  sap.ui.core.BusyIndicator.hide();

             window.alert("error");

   }

  );

what i need is to create tiles based on myData.Dashboard data in dashboard view..

myData will look like

var myData = { "Products":[{

                                         product : "Prod 1",

                                         revenue : 500000

                                       }, {

                                         product : "Prod 2",

                                         revenue : 700000

                                         }],

                        "Dashboard":[{

                                         module : "sd",

                                         count : 5,

                                        },

                                        {

                                         module : "mm",

                                         count : 6

                                             }]

                          };

data may varry

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Dec 29, 2014 at 07:57 AM

    HI Rajeesh

    Will this help?

    Example

    -D

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 29, 2014 at 06:55 AM

    Hi Rajessh

    I would recommend you to search first before posting this requirement

    A simple search has shown me

    Using dynamic tiles in SAPUI5

    Nabheet

    Add comment
    10|10000 characters needed characters exceeded