I have write some code navigate to the next page in SAPUI5. It works in most of my other SAPUI5 application. However, when comes to this application. It does not work for me.
I have spend 1 day to find out the solution but it seems does not work for me.
It always shown me the following error when I nav to the page.
Control with ID layout could not be found - EventProvider sap.m.routing.Target
The following is my source code
Manifest.JSON
"routing": {
"config": {
"routerClass": "sap.m.routing.Router",
"viewType": "XML",
"async": true,
"viewPath": "hackathon.customer.view",
"controlAggregation": "pages",
"controlId": "layout",
"clearControlAggregation": false
},
"routes": [
{
"name": "RouteApp",
"pattern": "RouteApp",
"target": [
"TargetApp"
]
},
{
"pattern": "ExtensibilityConfiguration",
"name": "ExtensibilityConfiguration",
"target": [
"ExtensibilityConfiguration"
]
}
],
"targets": {
"TargetApp": {
"viewType": "XML",
"transition": "slide",
"clearControlAggregation": false,
"viewName": "App"
},
"ExtensibilityConfiguration": {
"viewName": "ExtensibilityConfiguration",
"viewId": "Extensibility-Configuration",
"controlAggregation": "midColumnPages"
}
}
}
Controller.js
addNewExtensionItemPress: function()
{
this._oRouter.navTo("ExtensibilityConfiguration", {}, false);
},
View.xml
<mvc:View height="100%" controllerName="hackathon.customer.controller.App" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"
xmlns:l="sap.ui.layout" xmlns:f="sap.ui.layout.form" xmlns:core="sap.ui.core">
<App>
<pages>
<Page title="{i18n>title}">
<content>
<Panel>
<f:SimpleForm id="idSimpleForm" editable="true" layout="ResponsiveGridLayout" title="Customer details" labelSpanXL="3" labelSpanL="3"
labelSpanM="3" labelSpanS="12" adjustLabelSpan="false" emptySpanXL="4" emptySpanL="4" emptySpanM="4" emptySpanS="0" columnsXL="1"
columnsL="1" columnsM="1" singleContainerFullSize="false">
<f:content>
<Label text="Customer"/>
<ComboBox id="idComboBox" items="{newspageModel>/Customer}" selectionChange="onSelChange">
<core:Item key="{newspageModel>CUSTOMER_NO}" text="{newspageModel>CUSTOMER_NO}"/>
</ComboBox>
<Label text="Customer No."/>
<Input id="idCustNo" value="{model>/CUSTOMER_NO}" enabled="false"/>
<Label text="Customer Name"/>
<Input id="idCustName" value="{model>/CUSTOMER_NAME}" enabled="false"/>
<Label text="Address line 1"/>
<Input id="idCustAdd" value="{model>/ADDRESS_LINE1}" enabled="false"/>
<Label text="Address line 2"/>
<Input id="idCustAddt" value="{model>/ADDRESS_LINE2}" enabled="false"/>
<Label text="Private No."/>
<Input id="idPrivNo" value="{model>/PRIVATE_NO}" enabled="false" />
</f:content>
</f:SimpleForm>
<f:SimpleForm id="Extension_Form" editable="true" layout="ResponsiveGridLayout" labelSpanXL="3" labelSpanL="3"
labelSpanM="3" labelSpanS="12" adjustLabelSpan="false" emptySpanXL="4" emptySpanL="4" emptySpanM="4" emptySpanS="0" columnsXL="1"
columnsL="1" columnsM="1" singleContainerFullSize="false">
<f:content>
<core:Fragment fragmentName="hackathon.customer.view.fragment.CustomerExtension" type="XML"/>
</f:content>
</f:SimpleForm>
</Panel>
<Button id="ExtConBtn" width="200px" icon="sap-icon://add" text="Add New Field" press="addNewExtensionItemPress" />
</content>
<footer>
<Bar id="BottomBar">
<contentRight>
<Button id="edit" text="Edit" press="handleEditPress"/>
<Button id="save" text="Save" visible="false" press="handleSavePress"/>
</contentRight>
</Bar>
</footer>
</Page>
</pages>
</App>
</mvc:View>