0
votes

I have a Master-Detail Page on the first screen. On that screen, a dialog appears with 3 radio buttons. On clicking the first radio button, it should navigate to another page having a full-screen view but I am unable to do it. It is throwing the following error: Control SplitAppId does not have an aggregation called pages - EventProvider sap.ui.core.routing.Target. SplitAppId is the Id of the base page of Master-detail app. I know there is some error while routing but I am unable to figure it out. Please help. Below is the code. Thanks.

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"
                    }

                ]



            }
        }
    }

I want to navigate from noDataDetail to CreateTravelReq page.

2

2 Answers

0
votes

Instead of using Master-Detail page, I used Full screen page as base container which made the navigation and routing way too easy.

0
votes

I think the issue is in the "pattern" in the manifest.json, you have asked the router to navTo another screen without providing the link between both. Have a look at this sample by SAP Master-Detail with levels assuming each radio button is a product, which will navTo another view.

OR

Have a look at this application, showing how to navigate between master and double detail views Master-Detail Example