如何在项目MasterrDetail中使用全屏页面启动detailPage?

时间:2017-06-30 19:18:05

标签: sapui5 sap-fiori

我创建了一个项目,主屏幕是一个主页,第一个屏幕是身份验证,不需要侧边栏

enter image description here

的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") =未定义

3 个答案:

答案 0 :(得分:1)

添加:“fullWidth”:true

到“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
},

答案 1 :(得分:0)

在路由配置中,我可以看到应用ID为 idAppControl ,因此请尝试使用sap.ui.getCore()。byId(“idAppControl”);

答案 2 :(得分:0)

请在登录页面控制器onInit中尝试此代码:

this.getOwnerComponent().getAggregation("rootControl").byId("idAppControl")