0
votes

Using the SAP Web IDE I have created a new application from a Master/Detail template. The application works with the views that where created initially. Now i am trying to add another view called "FileDetail" to load into the detail window. I have added the view to the routes:

routing: {
    config: {
        routerClass: FileUtility.MyRouter,
        viewType: "XML",
        viewPath: "FileUtility.view",
        targetAggregation: "detailPages",
        clearTarget: false
    },
    routes: [
        {
            pattern: "",
            name: "main",
            view: "Master",
            targetAggregation: "masterPages",
            targetControl: "idAppControl",
            subroutes: [
                {
                    pattern: "{file}",
                    name: "fileDetail",
                    view: "FileDetail"
                },
                {
                    pattern: "{entity}/:tab:",
                    name: "detail",
                    view: "Detail",
                    subroutes: [

                    ]
                }

            ]
        },
        {
            name: "catchallMaster",
            view: "Master",
            targetAggregation: "masterPages",
            targetControl: "idAppControl",
            subroutes: [
                {
                    pattern: ":all*:",
                    name: "catchallDetail",
                    view: "NotFound",
                    transition: "show"
                }
            ]
        }
    ]
}

} ( I know this is not right but im just trying to force it to load the page ) When I the function

onFileSelect: function(oEvent) {
    this.getRouter().navTo("fileDetail", {
        from : "detail",
        file: oEvent.getSource().getBindingContext().getPath().slice(1)
    }, true);
},

is called I get an error in the JS console

Uncaught Error: failed to load 'view/FileDetail.controller.js' from resources/view/FileDetail.controller.js: 404 - Resource could not be found!

Here is the tree Tree

The only files i added where the FileDetail.controller.js and the FileDetail.view.xml and they where added with the new view wizard

Thanks for your help!

1
Can you show the structure of your application, for example a file tree?hirse

1 Answers

2
votes

My problem was in the namespace of the view. When i created the app i entered a namespace and when i created the view i was asked for the namespace of the view but did not provide any.

I fixed it by adding my namespace to the FileDetail.controller.js

Old

sap.ui.controller("view.FileDetail", {

New

sap.ui.controller("FileUtility.view.FileDetail", {

and in the FileDetail.view.xml

Old

<mvc:View
  xmlns:mvc="sap.ui.core.mvc"
  xmlns="sap.m"
  controllerName="view.FileDetail"
>

New

<mvc:View
  xmlns:mvc="sap.ui.core.mvc"
  xmlns="sap.m"
  controllerName="FileUtility.view.FileDetail"
>