Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

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

Former Member replied

HI Rajeesh

Will this help?

Example

-D

1 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question