Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/webapp/Component.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ sap.ui.define(["sap/ui/core/UIComponent", "z2ui5/model/models","z2ui5/cc/Server"
}
this.getRouter().initialize();
z2ui5.oRouter = this.getRouter();
this.setModel(Models.createDeviceModel(), "device");
z2ui5.oDeviceModel = Models.createDeviceModel();
this.setModel(z2ui5.oDeviceModel, "device");

z2ui5.oConfig = {};
z2ui5.oConfig.ComponentData = this.getComponentData();
Expand Down
2 changes: 1 addition & 1 deletion app/webapp/controller/App.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sap.ui.define(["sap/ui/core/mvc/Controller",

onInit: async function () {

z2ui5.oModel2 = this.getView().getModel("");
z2ui5.oOwnerComponent = this.getOwnerComponent();
z2ui5.oConfig.pathname = this.getView().getModel("http").sServiceUrl;
if (z2ui5?.checkLocal == true ) {
z2ui5.oConfig.pathname = window.location.href;
Expand Down
8 changes: 4 additions & 4 deletions app/webapp/controller/View1.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ sap.ui.define(["sap/ui/core/mvc/Controller", "sap/ui/core/mvc/XMLView", "sap/ui/
BusyIndicator.show();
z2ui5.oBody = {};
if (args[0][3] || z2ui5.oController == this ) {
if (z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL == true ){
if (z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL){
var oModel = z2ui5.oView.getModel( "http");
}else{
oModel = z2ui5.oView.getModel();
Expand Down Expand Up @@ -461,8 +461,8 @@ sap.ui.define(["sap/ui/core/mvc/Controller", "sap/ui/core/mvc/XMLView", "sap/ui/
async displayView(xml, viewModel) {
let oview_model = new JSONModel(viewModel);
var oModel = oview_model;
if (z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL == true){
oModel = z2ui5.oModel2;
if (z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL){
oModel = z2ui5.oOwnerComponent.getModel(z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL);
}
z2ui5.oView = await XMLView.create({
definition: xml,
Expand All @@ -478,7 +478,7 @@ sap.ui.define(["sap/ui/core/mvc/Controller", "sap/ui/core/mvc/XMLView", "sap/ui/
}
});
z2ui5.oView.setModel(z2ui5.oDeviceModel, "device");
if (z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL == true){
if (z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL){
z2ui5.oView.setModel(oview_model, "http");
}
this._oApp.removeAllPages();
Expand Down
6 changes: 3 additions & 3 deletions app/webapp/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"toolsId": "3a966e20-9635-4c28-8861-d1b66f79f1de"
},
"dataSources": {
"mainService": {
"test": {
"uri": "/sap/opu/odata/DMO/API_TRAVEL_U_V2/",
"type": "OData",
"settings": {
Expand Down Expand Up @@ -83,8 +83,8 @@
}
},
"models": {
"": {
"dataSource": "mainService",
"test": {
"dataSource": "test",
"preload": true,
"settings": {}
},
Expand Down
2 changes: 1 addition & 1 deletion src/01/02/z2ui5_if_core_types.intf.abap
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ INTERFACE z2ui5_if_core_types
BEGIN OF ty_s_next_frontend,
BEGIN OF s_view,
xml TYPE string,
switchDefaultModel TYPE abap_bool,
switchDefaultModel TYPE string,
check_destroy TYPE abap_bool,
check_update_model TYPE abap_bool,
END OF s_view,
Expand Down
2 changes: 1 addition & 1 deletion src/01/03/z2ui5_cl_app_app_js.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ CLASS z2ui5_cl_app_app_js IMPLEMENTATION.
`` && |\n| &&
` onInit: async function () {` && |\n| &&
`` && |\n| &&
` z2ui5.oModel2 = this.getView().getModel("");` && |\n| &&
` z2ui5.oOwnerComponent = this.getOwnerComponent();` && |\n| &&
` z2ui5.oConfig.pathname = this.getView().getModel("http").sServiceUrl;` && |\n| &&
` if (z2ui5?.checkLocal == true ) {` && |\n| &&
` z2ui5.oConfig.pathname = window.location.href;` && |\n| &&
Expand Down
3 changes: 2 additions & 1 deletion src/01/03/z2ui5_cl_app_component_js.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ CLASS z2ui5_cl_app_component_js IMPLEMENTATION.
` }` && |\n| &&
` this.getRouter().initialize();` && |\n| &&
` z2ui5.oRouter = this.getRouter();` && |\n| &&
` this.setModel(Models.createDeviceModel(), "device");` && |\n| &&
` z2ui5.oDeviceModel = Models.createDeviceModel();` && |\n| &&
` this.setModel(z2ui5.oDeviceModel, "device");` && |\n| &&
`` && |\n| &&
` z2ui5.oConfig = {};` && |\n| &&
` z2ui5.oConfig.ComponentData = this.getComponentData();` && |\n| &&
Expand Down
6 changes: 3 additions & 3 deletions src/01/03/z2ui5_cl_app_manifest_json.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ CLASS z2ui5_cl_app_manifest_json IMPLEMENTATION.
` "toolsId": "3a966e20-9635-4c28-8861-d1b66f79f1de"` &&
` },` &&
` "dataSources": {` &&
` "mainService": {` &&
` "test": {` &&
` "uri": "/sap/opu/odata/DMO/API_TRAVEL_U_V2/",` &&
` "type": "OData",` &&
` "settings": {` &&
Expand Down Expand Up @@ -103,8 +103,8 @@ CLASS z2ui5_cl_app_manifest_json IMPLEMENTATION.
` }` &&
` },` &&
` "models": {` &&
` "": {` &&
` "dataSource": "mainService",` &&
` "test": {` &&
` "dataSource": "test",` &&
` "preload": true,` &&
` "settings": {}` &&
` },` &&
Expand Down
8 changes: 4 additions & 4 deletions src/01/03/z2ui5_cl_app_view1_js.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ CLASS z2ui5_cl_app_view1_js IMPLEMENTATION.
` BusyIndicator.show();` && |\n| &&
` z2ui5.oBody = {};` && |\n| &&
` if (args[0][3] || z2ui5.oController == this ) {` && |\n| &&
` if (z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL == true ){` && |\n| &&
` if (z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL){` && |\n| &&
` var oModel = z2ui5.oView.getModel( "http");` && |\n| &&
` }else{` && |\n| &&
` oModel = z2ui5.oView.getModel();` && |\n| &&
Expand Down Expand Up @@ -481,8 +481,8 @@ CLASS z2ui5_cl_app_view1_js IMPLEMENTATION.
` async displayView(xml, viewModel) {` && |\n| &&
` let oview_model = new JSONModel(viewModel);` && |\n| &&
` var oModel = oview_model;` && |\n| &&
` if (z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL == true){` && |\n| &&
` oModel = z2ui5.oModel2;` && |\n| &&
` if (z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL){` && |\n| &&
` oModel = z2ui5.oOwnerComponent.getModel(z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL);` && |\n| &&
` }` && |\n| &&
` z2ui5.oView = await XMLView.create({` && |\n| &&
` definition: xml,` && |\n| &&
Expand All @@ -498,7 +498,7 @@ CLASS z2ui5_cl_app_view1_js IMPLEMENTATION.
` }` && |\n| &&
` });` && |\n| &&
` z2ui5.oView.setModel(z2ui5.oDeviceModel, "device");` && |\n| &&
` if (z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL == true){` && |\n| &&
` if (z2ui5.oResponse.PARAMS.S_VIEW?.SWITCHDEFAULTMODEL){` && |\n| &&
` z2ui5.oView.setModel(oview_model, "http");` && |\n| &&
` }` && |\n| &&
` this._oApp.removeAllPages();` && |\n| &&
Expand Down
2 changes: 1 addition & 1 deletion src/02/z2ui5_if_client.intf.abap
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ INTERFACE z2ui5_if_client
METHODS view_display
IMPORTING
val TYPE clike
switchDefaultModel TYPE abap_bool DEFAULT abap_false.
switchDefaultModel TYPE string OPTIONAL.

METHODS view_model_update.

Expand Down
Loading