Skip to content

Commit b92db09

Browse files
1 parent 7f500ce commit b92db09

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

app/webapp/Component.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ sap.ui.define(["sap/ui/core/UIComponent", "z2ui5/model/models","z2ui5/cc/Server"
1313
}
1414
this.getRouter().initialize();
1515
z2ui5.oRouter = this.getRouter();
16-
this.setModel(Models.createDeviceModel(), "device");
16+
z2ui5.oDeviceModel = Models.createDeviceModel();
17+
this.setModel(z2ui5.oDeviceModel, "device");
1718

1819
z2ui5.oConfig = {};
1920
z2ui5.oConfig.ComponentData = this.getComponentData();

app/webapp/controller/App.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sap.ui.define(["sap/ui/core/mvc/Controller",
55

66
onInit: async function () {
77

8-
z2ui5.oModel2 = this.getView().getModel("");
8+
z2ui5.oOwnerComponent = this.getOwnerComponent();
99
z2ui5.oConfig.pathname = this.getView().getModel("http").sServiceUrl;
1010
if (z2ui5?.checkLocal == true ) {
1111
z2ui5.oConfig.pathname = window.location.href;

app/webapp/controller/View1.controller.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ sap.ui.define(["sap/ui/core/mvc/Controller", "sap/ui/core/mvc/XMLView", "sap/ui/
346346
BusyIndicator.show();
347347
z2ui5.oBody = {};
348348
if (args[0][3] || z2ui5.oController == this ) {
349-
if (z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL == true ){
349+
if (z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL){
350350
var oModel = z2ui5.oView.getModel( "http");
351351
}else{
352352
oModel = z2ui5.oView.getModel();
@@ -461,8 +461,8 @@ sap.ui.define(["sap/ui/core/mvc/Controller", "sap/ui/core/mvc/XMLView", "sap/ui/
461461
async displayView(xml, viewModel) {
462462
let oview_model = new JSONModel(viewModel);
463463
var oModel = oview_model;
464-
if (z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL == true){
465-
oModel = z2ui5.oModel2;
464+
if (z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL){
465+
oModel = z2ui5.oOwnerComponent.getModel(z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL);
466466
}
467467
z2ui5.oView = await XMLView.create({
468468
definition: xml,
@@ -478,7 +478,7 @@ sap.ui.define(["sap/ui/core/mvc/Controller", "sap/ui/core/mvc/XMLView", "sap/ui/
478478
}
479479
});
480480
z2ui5.oView.setModel(z2ui5.oDeviceModel, "device");
481-
if (z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL == true){
481+
if (z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL){
482482
z2ui5.oView.setModel(oview_model, "http");
483483
}
484484
this._oApp.removeAllPages();

app/webapp/manifest.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"toolsId": "3a966e20-9635-4c28-8861-d1b66f79f1de"
1616
},
1717
"dataSources": {
18-
"mainService": {
18+
"test": {
1919
"uri": "/sap/opu/odata/DMO/API_TRAVEL_U_V2/",
2020
"type": "OData",
2121
"settings": {
@@ -83,8 +83,8 @@
8383
}
8484
},
8585
"models": {
86-
"": {
87-
"dataSource": "mainService",
86+
"test": {
87+
"dataSource": "test",
8888
"preload": true,
8989
"settings": {}
9090
},

0 commit comments

Comments
 (0)