未捕获的TypeError:sap.ui.core.UIComponent.getRouterFor不是函数

时间:2016-02-17 10:52:53

标签: sapui5 sap-fiori

我想在我的详细信息视图中使用路由来导航,我遇到了这个错误:

  

未捕获的TypeError:sap.ui.core.UIComponent.getRouterFor不是函数

下面你可以看到Component.js

jQuery.sap.declare("iwstoolbarui5.Component");
sap.ui.core.UIComponent.extend("iwstoolbarui5.Component", {

    metadata : {
        rootView : "iwstoolbarui5.Main",
        routing : {
            config : {
                targetsClass : "sap.m.routing.Targets",
                viewPath : "iwstoolbarui5",
                targetControl: "mainApp",
                controlId : "mainApp",
                controlAggregation : "detailPages",
                viewType : "XML"
            },

            routes:[

                   {

                pattern : "BPIdent",
                name : "Main",
                view : "Main",
                viewLevel : 0,
                targetAggregation : "masterPages",
                targetControl : "mainApp",
                subroutes : [
                        {
                            pattern : "/bpident:",
                            name : "BPIdent",
                            view : "BPIdent.BPIdent",
                            viewLevel : 1,
                            targetAggregation:"detailPages",
                            subroutes : [
                                    {
                                    pattern : "/accounts",
                                    name : "Accounts",
                                    view : "BPIdent.Accounts",
                                    viewLevel : 2,
                                    targetAggregation:"detailPages"
                            }
                        ]   
                   },
             init : function() {
             sap.ui.core.UIComponent.prototype.init.apply(this, arguments);
             this.gerRouter().initialize();
               }

这是我在BPident中的功能(这是我的详细页面之一)

selectInteraction: function(event) { 
            var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
            this.showDetail(event.getParameter("listItem") ||event.getSource());
},

showDetail : function(oItem) {  
            var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
            sap.ui.core.UIComponent.getRouter(this).navTo("BPIdent", {
                from: "master",
                BPIdent: oItem.getBindingContext().getPath().substr(1)});
        },

这是我索引的一部分:

sap.ui.getCore().attachInit(function() {
        new sap.ui.core.ComponentContainer({
            name : "iwstoolbarui5"
        });
    });

任何人都可以帮我这个吗?

0 个答案:

没有答案