on 02-20-2019 10:51 AM
Hi,
I've got an issue in a sapui5 application deployed to SAP Cloud Platform and registered to SAP Fiori launchpad.
I've got two data dources defined in my manifest.json : mainService (xsodata), and backendService (odata from OData Provisioning service connected to an ECC backend).
On first application load, data from both services are displayed. When I come back to the launchpad, and I launch again my application, data from backendService is not retrieve.
Code:
this.getModel("backend").read(
"/*********('" + oResponseUser.*****+ "')", {
success: fSuccess,
error: fError
}
);
Error (only after came back on launchpad and launch app again):
Uncaught (in promise) TypeError: Cannot read property 'loaded' of undefined
at constructor.y._processRequest (ODataModel-dbg.js:4110)
at constructor.y.read (ODataModel-dbg.js:4625)
at f._loadModelUser (App.controller.js?eval:1) ==> Where is my .read() call
at constructor.b._callListener (EventBus-dbg.js:232)
at constructor.b.publish (EventBus-dbg.js:219)
at f._onBindingChange (Detail.controller.js?eval:1)
at constructor.b.fireEvent (EventProvider-dbg.js:228)
at constructor.B._fireChange (Binding-dbg.js:277)
at constructor.O._fireChange (ODataContextBinding-dbg.js:343)
at ODataContextBinding-dbg.js:101
In my manifest.json :
"dataSources": {
"mainService": {
"uri": "/*******/***.xsodata/",
"type": "OData",
"settings": {
"odataVersion": "2.0",
"localUri": "localService/metadata.xml"
}
},
"backendService": {
"uri": "/odata/*****/****_SRV;v=1/",
"type": "OData",
"settings": {
"odataVersion": "2.0",
"localUri": "localService/****_SRV/metadata.xml"
}
}
}
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"settings": {
"bundleName": "*******.i18n.i18n"
}
},
"": {
"dataSource": "mainService",
"preload": true,
"settings": {
"disableHeadRequestForToken": true
}
},
"backend": {
"dataSource": "****_SRV",
"preload": true,
"settings": {
"loadAnnotationsJoined": true,
"defaultOperationMode": "Server",
"defaultBindingMode": "TwoWay"
}
}
}
May you help me please?
Cheers,
Sev
I found a solution. My method getModel was in my BaseController:
getModel : function (sName) {
return this.getView().getModel(sName);
},
For OData models, I created a new function:
getODataModel : function (sName) {
return this.getOwnerComponent().getModel(sName);
},
From now, each OData call is made with getODataModel, and because I call it with getOwnerComponent, model is not destroyed anymore.
Hope it will help.
Cheers,
Sev
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Check the network requests in the console. Are any network requests fired the second time? And if so, is there data?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
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.