Skip to Content

split view error in sample app

HI Guys,

i am trying to create splitview page.i am getting ths error

The target Main has no controlId set and no parent so the target cannot be displayed. - EventProvider sap.ui.core.routing.Target

Manifest.json

{
	"_version": "1.7.0",
	"sap.app": {
		"id": "finalappfinalapp",
		"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": "finalappfinalapp.view.App",
			"type": "XML"
		},
		"dependencies": {
			"minUI5Version": "1.30.0",
			"libs": {
				"sap.ui.core": {},
				"sap.m": {},
				"sap.ui.layout": {},
				"sap.ushell": {},
				"sap.collaboration": {},
				"sap.ui.comp": {},
				"sap.uxap": {}
			}
		},
		"contentDensities": {
			"compact": true,
			"cozy": true
		},
		"models": {
			"i18n": {
				"type": "sap.ui.model.resource.ResourceModel",
				"settings": {
					"bundleName": "finalappfinalapp.i18n.i18n"
				}
			}
		},
		"resources": {
			"css": [{
				"uri": "css/style.css"
			}]
		},
		"routing": {
			"config": {
				"viewPath": "finalappfinalapp.view",
				"viewType": "XML",
				"transition": "slide",
				"clearTarget" : false
			},
			"targets": {
				"Main": {
					"viewType": "XML",
					"transition": "slide",
					"clearAggregation": true,
					"viewName": "Main",
					"title": "Main",
					
					"viewPath": "finalappfinalapp.view.Main"
				},
				"Detail": {
					"viewType": "XML",
					"transition": "slide",
					"clearAggregation": true,
					"viewName": "Detail",
					"title": "Detail",
					"controlId": "SplitApp",
					"viewPath": "finalappfinalapp.view.Detail"
				}
			},
			"routes": [ {
				"name": "Main",
				"pattern": "",
				"titleTarget": "Main",
				"controlAggregation":"mainpage",
				"target": ["Main"]
			}, {
				"name": "Detail",
				"pattern": "",
				"titleTarget": "Detail",
				"target": ["Detail"]
			}]
		}
	}
}

App.xml

<mvc:View controllerName="finalappfinalapp.controller.App" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:mvc="sap.ui.core.mvc"
	displayBlock="true" xmlns="sap.m">
	<SplitApp id="splitApp" />
</mvc:View>

Main.xml

<mvc:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" controllerName="finalappfinalapp.controller.Main"
	xmlns:html="http://www.w3.org/1999/xhtml">
	<App>
		<pages>
			<Page title="Main">
				<content></content>
			</Page>
		</pages>
	</App>
</mvc:View>

Detail.xml

<mvc:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" controllerName="finalappfinalapp.controller.Detail"
	xmlns:html="http://www.w3.org/1999/xhtml">
	<App>
		<pages>
			<Page title="Detail">
				<content></content>
			</Page>
		</pages>
	</App>
</mvc:View>

Component.js

sap.ui.define([
	"sap/ui/core/UIComponent",
	"sap/ui/Device",
	"finalappfinalapp/model/models"
], function(UIComponent, Device, models) {
	"use strict";


	return UIComponent.extend("finalappfinalapp.Component", {


		metadata: {
			manifest: "json"
		},


		/**
		 * The component is initialized by UI5 automatically during the startup of the app and calls the init method once.
		 * @public
		 * @override
		 */
		init: function() {
			// call the base component's init function
			UIComponent.prototype.init.apply(this, arguments);
			this.getRouter().initialize();
			// set the device model
			this.setModel(models.createDeviceModel(), "device");
		}
	});
});

Please suggest me to design the page

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Sep 20, 2017 at 05:54 AM

    Hi,

    Under Manifest.json file, In Routing section change as given below.

    "controlAggregation": "masterPages"

    And in your view please remove <App> container. Its not required.Your views has to like this

    <mvc:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" controllerName="finalappfinalapp.controller.Detail"
    	xmlns:html="http://www.w3.org/1999/xhtml">
    		<Page title="Detail">
    				<content></content>
    			</Page>
    </mvc:View>

    Please try this.

    Add comment
    10|10000 characters needed characters exceeded