on 05-31-2016 1:36 AM
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();
},
});
Hi Krzysztof:
Can you attach the screen shot of the console in F12 developer options of browser, so that we can see that error you are getting.
One issue could be cross-origin not allowed: in that you need to create the destination in HCP and than you need to create the project using the northWind service.
One more issue you need to define the same destination in neo app .json file so that project should know which service it needs to call from the destination.
Thanks
Viplove
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
after getting service URL you have to make service calls to backend
var oModel = new sap.ui.model.odata.ODataModel(sServiceUrl, true);
oModel .read("/entitysetname", {
success: mathodToCallOnSuccess,
error: mathodToCallOnError
});
// before you set model check how data is coming from back end and bind accordingly to view
//in Component level
this.setModel(oModel);
//to set to core
sap.ui.getCore().setModel( oModel,"somelName");
---------------------------------------------------
correct me if i am wrongly understood your question
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.