如何在 MasterrDetail 项目中以全屏页面启动详细页面?
How to start a detailPage with fullscreen page in project MasterrDetail?
我创建了一个项目,主屏是主页,首屏是身份验证,不需要侧边栏
manifest.json:
{
"_version": "1.1.0",
"start_url": "index.html",
"sap.app": {
"_version": "1.2.0",
"id": "generate.app",
"type": "application",
"i18n": "i18n/i18n.properties",
"title": "{{appTitle}}",
"description": "{{appDescription}}",
"applicationVersion": {
"version": "1.0.0"
},
"ach": "ach",
"resources": "resources.json",
"dataSources": {
"main": {
"uri": "/here/goes/your/serviceurl/",
"type": "OData",
"settings": {
"defaultUpdateMethod": "PUT",
"odataVersion": "2.0",
"localUri": "localService/metadata.xml"
}
}
},
"sourceTemplate": {
"id": "sap.ui.ui5-template-plugin.2masterdetail",
"version": "1.32.5"
},
"crossNavigation": {
"inbounds": {}
}
},
"sap.ui": {
"_version": "1.2.0",
"technology": "UI5",
"icons": {
"icon": "sap-icon://detail-view",
"favIcon": "",
"phone": "",
"phone@2": "",
"tablet": "",
"tablet@2": ""
},
"deviceTypes": {
"desktop": true,
"tablet": true,
"phone": true
},
"supportedThemes": []
},
"sap.ui5": {
"_version": "1.1.0",
"rootView": {
"viewName": "generated.app.view.App",
"type": "XML",
"id": "app"
},
"dependencies": {
"minUI5Version": "1.32.0",
"libs": {
"sap.ui.core": {},
"sap.m": {}
}
},
"contentDensities": {
"compact": true,
"cozy": true
},
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"uri": "i18n/i18n.properties"
},
"": {
"dataSource": "main",
"type": "sap.ui.model.odata.v2.ODataModel",
"settings": {
"loadMetadataAsync": false,
"json": true,
"bJSON": true,
"defaultBindingMode": "TwoWay",
"useBatch": true,
"refreshAfterChange": false,
"disableHeadRequestForToken": true
}
}
},
"routing": {
"config": {
"routerClass": "sap.m.routing.Router",
"viewType": "XML",
"viewPath": "generated.app.view",
"controlId": "idAppControl",
"controlAggregation": "detailPages",
"bypassed": {
"target": ["login"]
}
},
"routes": [{
"pattern": "login",
"name": "login",
"target": ["login"]
}, {
"pattern": "tiles",
"name": "tiles",
"target": ["tiles"]
}, {
"name": "listainvestimento",
"pattern": "listainvestimento",
"titleTarget": "",
"greedy": false,
"target": ["detalheinvestimento", "listainvestimento"]
}, {
"name": "detalheinvestimento",
"pattern": "listainvestimento/detalheinvestimento",
"titleTarget": "",
"greedy": false,
"target": ["listainvestimento", "detalheinvestimento"]
}, {
"pattern": "listacontrato",
"name": "listacontrato",
"target": ["detalhecontrato", "listacontrato"]
}, {
"pattern": "listacontrato/detalhecontrato/:context:",
"name": "detalhecontrato",
"target": ["listacontrato", "detalhecontrato"]
}],
"targets": {
"login": {
"controlAggregation": "detailPages",
"viewName": "login",
"viewId": "login",
"viewLevel": 1
},
"tiles": {
"controlAggregation": "detailPages",
"viewName": "tiles",
"viewId": "tiles",
"viewLevel": 1
},
"listainvestimento": {
"controlAggregation": "masterPages",
"viewName": "listainvestimento",
"viewId": "listainvestimento",
"viewLevel": 1
},
"listacontrato": {
"controlAggregation": "masterPages",
"viewName": "listacontrato",
"viewId": "listacontrato",
"viewLevel": 1
},
"novoinvestimento": {
"controlAggregation": "detailPages",
"viewName": "novoinvestimento",
"viewId": "novoinvestimento",
"viewLevel": 2
},
"detalheinvestimento": {
"controlAggregation": "detailPages",
"viewName": "detalheinvestimento",
"viewId": "detalheinvestimento",
"viewLevel": 2
},
"detalhecontrato": {
"controlAggregation": "detailPages",
"viewName": "detalhecontrato",
"viewId": "detalhecontrato",
"viewLevel": 2
},
"novocontrato": {
"controlAggregation": "detailPages",
"viewName": "novocontrato",
"viewId": "novocontrato",
"viewLevel": 2
}
}
}
},
"sap.fiori": {
"_version": "1.1.0",
"registrationIds": [],
"archeType": "transactional"
}
}
在登录页面的控件中,我有这样的代码:
try{
sap.ui.getCore().byId("App").setMode(sap.m.SplitAppMode.HideMode);
}
catch(e){
}
但是 sap.ui.getCore().byId("App")
= undefined
在路由配置中我可以看到应用程序 ID 为 idAppControl ,所以尝试 sap.ui.getCore().byId("idAppControl");
请在您的登录页面控制器中尝试此代码onInit
:
this.getOwnerComponent().getAggregation("rootControl").byId("idAppControl")
添加:"fullWidth":真
到"sap.ui":
"sap.ui": {
"technology": "UI5",
"icons": {
"icon": "sap-icon://detail-view",
"favIcon": "",
"phone": "",
"phone@2": "",
"tablet": "",
"tablet@2": ""
},
"deviceTypes": {
"desktop": true,
"tablet": true,
"phone": true
},
"supportedThemes": ["sap_belize", "sap_hcb", "sap_bluecrystal"],
"fullWidth": true
},
我创建了一个项目,主屏是主页,首屏是身份验证,不需要侧边栏
manifest.json:
{
"_version": "1.1.0",
"start_url": "index.html",
"sap.app": {
"_version": "1.2.0",
"id": "generate.app",
"type": "application",
"i18n": "i18n/i18n.properties",
"title": "{{appTitle}}",
"description": "{{appDescription}}",
"applicationVersion": {
"version": "1.0.0"
},
"ach": "ach",
"resources": "resources.json",
"dataSources": {
"main": {
"uri": "/here/goes/your/serviceurl/",
"type": "OData",
"settings": {
"defaultUpdateMethod": "PUT",
"odataVersion": "2.0",
"localUri": "localService/metadata.xml"
}
}
},
"sourceTemplate": {
"id": "sap.ui.ui5-template-plugin.2masterdetail",
"version": "1.32.5"
},
"crossNavigation": {
"inbounds": {}
}
},
"sap.ui": {
"_version": "1.2.0",
"technology": "UI5",
"icons": {
"icon": "sap-icon://detail-view",
"favIcon": "",
"phone": "",
"phone@2": "",
"tablet": "",
"tablet@2": ""
},
"deviceTypes": {
"desktop": true,
"tablet": true,
"phone": true
},
"supportedThemes": []
},
"sap.ui5": {
"_version": "1.1.0",
"rootView": {
"viewName": "generated.app.view.App",
"type": "XML",
"id": "app"
},
"dependencies": {
"minUI5Version": "1.32.0",
"libs": {
"sap.ui.core": {},
"sap.m": {}
}
},
"contentDensities": {
"compact": true,
"cozy": true
},
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"uri": "i18n/i18n.properties"
},
"": {
"dataSource": "main",
"type": "sap.ui.model.odata.v2.ODataModel",
"settings": {
"loadMetadataAsync": false,
"json": true,
"bJSON": true,
"defaultBindingMode": "TwoWay",
"useBatch": true,
"refreshAfterChange": false,
"disableHeadRequestForToken": true
}
}
},
"routing": {
"config": {
"routerClass": "sap.m.routing.Router",
"viewType": "XML",
"viewPath": "generated.app.view",
"controlId": "idAppControl",
"controlAggregation": "detailPages",
"bypassed": {
"target": ["login"]
}
},
"routes": [{
"pattern": "login",
"name": "login",
"target": ["login"]
}, {
"pattern": "tiles",
"name": "tiles",
"target": ["tiles"]
}, {
"name": "listainvestimento",
"pattern": "listainvestimento",
"titleTarget": "",
"greedy": false,
"target": ["detalheinvestimento", "listainvestimento"]
}, {
"name": "detalheinvestimento",
"pattern": "listainvestimento/detalheinvestimento",
"titleTarget": "",
"greedy": false,
"target": ["listainvestimento", "detalheinvestimento"]
}, {
"pattern": "listacontrato",
"name": "listacontrato",
"target": ["detalhecontrato", "listacontrato"]
}, {
"pattern": "listacontrato/detalhecontrato/:context:",
"name": "detalhecontrato",
"target": ["listacontrato", "detalhecontrato"]
}],
"targets": {
"login": {
"controlAggregation": "detailPages",
"viewName": "login",
"viewId": "login",
"viewLevel": 1
},
"tiles": {
"controlAggregation": "detailPages",
"viewName": "tiles",
"viewId": "tiles",
"viewLevel": 1
},
"listainvestimento": {
"controlAggregation": "masterPages",
"viewName": "listainvestimento",
"viewId": "listainvestimento",
"viewLevel": 1
},
"listacontrato": {
"controlAggregation": "masterPages",
"viewName": "listacontrato",
"viewId": "listacontrato",
"viewLevel": 1
},
"novoinvestimento": {
"controlAggregation": "detailPages",
"viewName": "novoinvestimento",
"viewId": "novoinvestimento",
"viewLevel": 2
},
"detalheinvestimento": {
"controlAggregation": "detailPages",
"viewName": "detalheinvestimento",
"viewId": "detalheinvestimento",
"viewLevel": 2
},
"detalhecontrato": {
"controlAggregation": "detailPages",
"viewName": "detalhecontrato",
"viewId": "detalhecontrato",
"viewLevel": 2
},
"novocontrato": {
"controlAggregation": "detailPages",
"viewName": "novocontrato",
"viewId": "novocontrato",
"viewLevel": 2
}
}
}
},
"sap.fiori": {
"_version": "1.1.0",
"registrationIds": [],
"archeType": "transactional"
}
}
在登录页面的控件中,我有这样的代码:
try{
sap.ui.getCore().byId("App").setMode(sap.m.SplitAppMode.HideMode);
}
catch(e){
}
但是 sap.ui.getCore().byId("App")
= undefined
在路由配置中我可以看到应用程序 ID 为 idAppControl ,所以尝试 sap.ui.getCore().byId("idAppControl");
请在您的登录页面控制器中尝试此代码onInit
:
this.getOwnerComponent().getAggregation("rootControl").byId("idAppControl")
添加:"fullWidth":真
到"sap.ui":
"sap.ui": {
"technology": "UI5",
"icons": {
"icon": "sap-icon://detail-view",
"favIcon": "",
"phone": "",
"phone@2": "",
"tablet": "",
"tablet@2": ""
},
"deviceTypes": {
"desktop": true,
"tablet": true,
"phone": true
},
"supportedThemes": ["sap_belize", "sap_hcb", "sap_bluecrystal"],
"fullWidth": true
},