on 02-03-2020 6:35 PM
Hello Experts,
I want to create to two different offline stores, since i am using two different OData services in my mobile Application.
Here is my below code which i used to create Offline stores (sap-mobile-hybrid.js).
var stores;
openStore: function () {
jQuery.sap.require("sap.ui.thirdparty.datajs");
var properties = [{
"name": "ZABC",
"host": sap.hybrid.kapsel.appContext.registrationContext.serverHost,
"port": sap.hybrid.kapsel.appContext.registrationContext.serverPort,
"https": sap.hybrid.kapsel.appContext.registrationContext.https,
"serviceRoot": fiori_client_appConfig.appID + "_abcSet/sap/ZABC/",
"definingRequests": {
"abcSet": "/abcSet"
}
}, {
"name": "ZXYZ",
"host": sap.hybrid.kapsel.appContext.registrationContext.serverHost,
"port": sap.hybrid.kapsel.appContext.registrationContext.serverPort,
"https": sap.hybrid.kapsel.appContext.registrationContext.https,
"serviceRoot": fiori_client_appConfig.appID + "_xyzSet/sap/ZXYZ/",
"definingRequests": {
"abSet": "/ab",
"pqSet": "/pq"
}
}];
for (var i = 0; i < properties.length; i++) {
stores = sap.OData.createOfflineStore(properties[i]);
var openStoreSuccessCallback = function () {
sap.OData.applyHttpClient();
sap.hybrid.startApp();
}
var openStoreErrorCallback = function (error) {
alert("An error occurred" + JSON.stringify(error));
}
stores.open(openStoreSuccessCallback, openStoreErrorCallback);
}
}
The issue i am currently facing is that the offline stores are getting created but duplicate views are also getting created.
For Example : If am using Table control in a page and if i scroll down the table list, another Table control has already been created in the same page.
Kindly Please help me is these issue.
Hi Chetan,
A similar query was posted here: https://blogs.sap.com/2018/05/22/creating-an-offline-crud-hybrid-mobile-app-in-sap-web-ide-full-stac...
I recommend creating 2 separate openStore functions with separate properties and defining requests.
Besides that, your code handles the openStoreSuccessCallback twice, resulting in duplicate calls to applyHttpClient() and startApp(). In the first success callback you could call the 2nd openStore function (just a suggestion).
Regards,
Ludo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
74 | |
10 | |
8 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.