【问题标题】:Unable to Route to a full screen page from a Master Detail View in SAPUI5无法从 SAPUI5 中的主详细信息视图路由到全屏页面
【发布时间】:2018-09-13 20:11:11
【问题描述】:

我在第一个屏幕上有一个主从页面。在该屏幕上,会出现一个带有 3 个单选按钮的对话框。单击第一个单选按钮时,它应该导航到具有全屏视图的另一个页面,但我无法做到。它抛出以下错误:Control SplitAppId 没有名为 pages 的聚合 - EventProvider sap.ui.core.routing.Target。 SplitAppId 是主从应用的基本页面的Id。我知道路由时有一些错误,但我无法弄清楚。请帮忙。下面是代码。谢谢。

noDataDetail.controller.js:

        sap.ui.define([
        "sap/ui/core/mvc/Controller"
    ], function (Controller) {
        "use strict";

        return Controller.extend("hmel.CreateTravelRequest.controller.noDataDetail", {

            onInit: function()
        {
            this.router = sap.ui.core.UIComponent.getRouterFor(this);
                this.router.attachRoutePatternMatched(this.handleRouteMatched, this);
        },


            handleRouteMatched: function(oEvent) {
                if (oEvent.getParameter("name") !== "noDataDetail") {
                    return;
                }
                this.selectionFragment = sap.ui.xmlfragment("hmel.CreateTravelRequest.view.SelectDialog", this);
                this.getView().addDependent(this.selectionFragment);
                this.selectionFragment.open();
            },

                onSubmit: function() {
                var radioBtnGrp = sap.ui.getCore().byId("radioBtnGrpId");
                var selectedIndex = radioBtnGrp.getSelectedIndex();

                this.selectionFragment.close();
                this.selectionFragment.destroy();
                this.selectionFragment = null;

                if (selectedIndex === 0) {
                    this.onTravelReqCreate();
                } else if (selectedIndex === 1) {
                    this.onGuestHouseApproval();
                } else if (selectedIndex === 2) {
                    this.onMealApproval();
                }
            }
            ,

            onTravelReqCreate: function() {
                this.router.navTo("CreateTravelReq");
            }/*,

            onMealApproval: function() {
                this.router.navTo("MealMaster");
            },

            onGuestHouseApproval: function() {
                this.router.navTo("GuestHouseMaster");
            }*/


        });

    });

manifest.json:

        {
        "_version": "1.8.0",
        "sap.app": {
            "id": "hmel.CreateTravelRequest",
            "type": "application",
            "i18n": "i18n/i18n.properties",
            "applicationVersion": {
                "version": "1.0.0"
            },
            "title": "{{appTitle}}",
            "description": "{{appDescription}}",
            "sourceTemplate": {
                "id": "ui5template.basicSAPUI5ApplicationProject",
                "version": "1.40.12"
            }
        },
        "sap.ui": {
            "technology": "UI5",
            "icons": {
                "icon": "",
                "favIcon": "",
                "phone": "",
                "phone@2": "",
                "tablet": "",
                "tablet@2": ""
            },
            "deviceTypes": {
                "desktop": true,
                "tablet": true,
                "phone": true
            },
            "supportedThemes": [
                "sap_hcb",
                "sap_belize"
            ]
        },
        "sap.ui5": {
            "rootView": {
                "viewName": "hmel.CreateTravelRequest.view.noDataSplitApp",
                "type": "XML"
            },
            "dependencies": {
                "minUI5Version": "1.30.0",
                "libs": {
                    "sap.ui.layout": {},
                    "sap.ui.core": {},
                    "sap.m": {}
                }
            },
            "contentDensities": {
                "compact": true,
                "cozy": true
            },
            "models": {
                "i18n": {
                    "type": "sap.ui.model.resource.ResourceModel",
                    "settings": {
                        "bundleName": "hmel.CreateTravelRequest.i18n.i18n"
                    }
                }
            },
            "resources": {
                "css": [
                    {
                        "uri": "css/style.css"
                    }
                ]
            },
            "routing": {
                "config": {
                    "routerClass": "sap.m.routing.Router",
                    "viewType": "XML",
                    "async": true,
                    "viewPath": "hmel.CreateTravelRequest.view",
                    "targetAggregation": "masterPages",
                    "clearTarget": false
                },
                "routes": [
                    {
                        "pattern": "",
                        "name": "noDataMaster",
                        "view": "noDataMaster",
                        "targetControl": "SplitAppId",
                        "subroutes": [
                            {
                                "pattern": "",
                                "name": "noDataDetail",
                                "view": "noDataDetail",
                                "targetAggregation": "detailPages"
                            }
                        ]
                    },

                    {
                        "pattern": "CreateTravelReq",
                        "targetAggregation":"pages",
                         "name": "CreateTravelReq",
                         "viewPath": "hmel.CreateTravelRequest.view",
                         "view":"CreateTravelReq",
                         "controlId":"SplitAppId"
                    }

                ]



            }
        }
    }

我想从 noDataDetail 导航到 CreateTravelReq 页面。

【问题讨论】:

    标签: javascript sapui5 manifest


    【解决方案1】:

    我没有使用 Master-Detail 页面,而是使用全屏页面作为基本容器,这使得导航和路由方式过于简单。

    【讨论】:

      【解决方案2】:

      我认为问题出在 manifest.json 中的“模式”中,您已要求路由器 navTo 另一个屏幕,但未提供两者之间的链接。看看 SAP Master-Detail with levels 的这个示例,假设每个单选按钮都是一个产品,它将导航到另一个视图。

      看看这个应用程序,它展示了如何在主视图和双细节视图之间导航Master-Detail Example

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-01-02
        • 1970-01-01
        • 1970-01-01
        • 2010-12-06
        • 2012-03-25
        相关资源
        最近更新 更多