主详细信息上的SAPUI5自定义导航路由器

时间:2016-05-27 13:10:48

标签: sapui5 sap-fiori

我正在扩展现有的FIORI应用程序。该应用程序是一个主要的细节应用程序。我在导航到自定义详细信息页面时遇到问题。我顺便使用SAP WEB IDE。

这是我在主视图的控制器上实现的代码段。我可以毫无问题地得到Matnr。

  this.oRouter.navTo("newView",{
     Matnr :  i.getBindingContext().getProperty("Matnr")
  });

这是我的component.js

的一部分
this.cus.sd.salesorder.create.Component.extend("cus.sd.salesorder.create.SD_SO_CREExtension.Component", {
    metadata: {
        version: "1.0",

        routing: 
        {

            "routes" : {

                "newView": {
                "pattern": "newView/{Matnr}",
                 "view":"cus.sd.salesorder.create.SD_SO_CREExtension.view.CustomView",


                }

            },

         },

这是我的CustomView视图

<mvc:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"
    controllerName="cus.sd.salesorder.create.SD_SO_CREExtension.view.CustomView" xmlns:html="http://www.w3.org/1999/xhtml">
    <App>
        <pages>
            <Page title="Title">
                <content>
                    <Label text = "hello"></Label>
                </content>
            </Page>
        </pages>
    </App>
</mvc:View>

这是控制器

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

        return Controller.extend("cus.sd.salesorder.create.SD_SO_CREExtension.view.CustomView", {

                onInit: function() {
                    alert("hello");
                },
        });

});

检查URL后,它似乎正在访问它

...树液-UI-XX-componentPreload = OFF&安培;原始-URL = index.html的&安培;树液-UI-appCacheBuster = ..%2F#&安培; / NewView的/ 14

但我看不到任何标签组件。

1 个答案:

答案 0 :(得分:0)

由于您使用的是SAP WebIDE,因此可以考虑使用扩展项目。使用扩展项目可以避免一些手动编码。从原始项目的上下文菜单中,转到新建&gt;扩建项目。这将创建一个引用原始项目的项目。然后,您可以决定是否要复制原始视图并进行调整或从头开始创建自己的视图。您可以通过进入扩展项目&gt;来完成此操作。工具&gt;可扩展性窗格。在窗格中,展开要调整/扩展的视图&gt;右键单击&gt;你可以复制和改编,或写自己的观点。 您可以在Extending SAPUI5 Applications下的帮助中找到更多信息。

相关问题