Advertisement
ignatov

Untitled

Apr 20th, 2020
1,359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. sap.ui.define([
  2.     "sap/ui/core/mvc/Controller",
  3.     "sap/ui/model/odata/v2/ODataModel"
  4. ], function(Controller, ODataModel) {
  5.     "use strict";
  6.  
  7.     return Controller.extend("com.app2.controller.View1", {
  8.         onInit: function() {
  9.        
  10.         var sUrl = "/sap/opu/odata/SAP/ZDEMO_APP1_SRV";
  11.         var oDataModel = new sap.ui.model.odata.v2.ODataModel(sUrl, {
  12.                         json: true,
  13.                         loadMetadataAsync: true
  14.         });
  15.         oDataModel.setUseBatch(false);
  16.         var oModel = new sap.ui.model.json.JSONModel();
  17.         oDataModel.read("/PersonSet", {
  18.             success: function(oData, response) {
  19.             oModel.setData(oData);
  20.             var oTempResult = oData.results;
  21.         }});
  22.        
  23.         this.getView().setModel(oModel, "person");
  24.         }
  25.     });
  26. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement