gpt4 book ai didi

javascript - SAPUI5:无法导航到定义的页面并出现错误(无法找到具有 ID 布局的控件 - EventProvider sap.m.routing.Target)

转载 作者:行者123 更新时间:2023-12-03 01:00:10 27 4
gpt4 key购买 nike

我已经编写了一些代码导航到 SAPUI5 中的下一页。它适用于我的大多数其他 SAPUI5 应用程序。然而,当谈到这个应用程序时。它对我不起作用。

我花了 1 天的时间来找到解决方案,但似乎确实如此不适合我。

当我导航到该页面时,它总是显示以下错误。

Control with ID layout could not be found - EventProvider sap.m.routing.Target

以下是我的源代码

list .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);
},

查看.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>

最佳答案

试试这个。希望对您有所帮助。

 <App id="layout">

关于javascript - SAPUI5:无法导航到定义的页面并出现错误(无法找到具有 ID 布局的控件 - EventProvider sap.m.routing.Target),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52657925/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com