Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9069

oData sapui5 example - no data

$
0
0

Hi,

 

I created very similar app to this from Building - User Interface Add-On for SAP NetWeaver - SAP Library

in component.js i putted url of oData from Northwind  http://services.odata.org/Northwind/Northwind.svc/ but I am still getting info "no data"

What is the reason of that?

 

jQuery.sap.declare("ksl.md1.Component");

jQuery.sap.require("ksl.md1.MyRouter");

 

 

sap.ui.core.UIComponent.extend("ksl.md1.Component", {

metadata : {

name : "Master detail app",

version : "1.1",

includes : [],

dependencies : {

  libs : ["sap.m", "sap.ui.layout"],

  components : []

},

rootView : "ksl.md1.view.App",

 

 

config : {

  resourceBundle : "i18n/messageBundle.properties",

  serviceConfig : {

   serviceURL : "http://services.odata.org/Northwind/Northwind.svc/"

   

  }

},

routing : {

   config : {

    routerClass : ksl.md1.MyRouter,

    viewType : "XML",

    viewPath : "ksl.md1.view",

    targetAggregation : "detailPages",

    clearTarget : false

   },

  routes : [

   {  

    pattern : "",

    name : "main",

    view : "Master",

    targetAggregation : "masterPages",

    targetControl : "idAppControl",

    subroutes : [

           {

                                        pattern : "{product}/:tab:",

                                        name : "detail",

                                        view : "Detail"

                                    }

                                  ]

                  },

                  {

                      name : "catchallMaster",

                      view : "Master",

                      targetAggregation : "masterPages",

                      targetControl : "idAppControl",

                      subroutes : [

                                    {

                                        pattern : ":all*:",

                                        name : "catchallDetail",

                                        view : "NotFound",

                                        transition: "show"

                                    }

                                  ]

                  }

                 ]

    }

},

 

 

init : function() {

 

    sap.ui.core.UIComponent.prototype.init.apply(this, arguments);

 

 

    var mConfig = this.getMetadata().getConfig();

 

 

    // always use absolute paths relative to our own component

    // (relative paths will fail if running in the Fiori Launchpad)

    var rootPath = jQuery.sap.getModulePath("ksl.md1");

 

 

    // set i18n model

    var i18nModel = new sap.ui.model.resource.ResourceModel({

        bundleUrl : [rootPath, mConfig.resourceBundle].join("/")

    });

    this.setModel(i18nModel, "i18n");

 

 

// Create and set domain model to the component

    var sServiceUrl = mConfig.serviceConfig.serviceUrl;

   

    var oModel = new sap.ui.model.odata.ODataModel(sServiceUrl, true);

   

// var oModel = new sap.ui.model.xml.XMLModel(sServiceUrl)

    this.setModel(oModel);

 

 

    // set device model

    var deviceModel = new sap.ui.model.json.JSONModel({

        isTouch : sap.ui.Device.support.touch,

        isNoTouch : !sap.ui.Device.support.touch,

        isPhone : sap.ui.Device.system.phone,

        isNoPhone : !sap.ui.Device.system.phone,

        listMode : sap.ui.Device.system.phone ? "None" : "SingleSelectMaster",

        listItemType : sap.ui.Device.system.phone ? "Active" : "Inactive"

    });

    deviceModel.setDefaultBindingMode("OneWay");

   

    this.setModel(deviceModel, "device");

 

 

    this.getRouter().initialize();

},

});


Viewing all articles
Browse latest Browse all 9069

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>