1
votes

I'm Trying navigate from Master view to Multiple detail views. But I don't know how do it in component.js, all the samples are simple detail views. I can Navigate to all views but I can't get the binding from odata, only the last detail view in routing work's correctly.

component.js code:

    routing : {
        config : {
            routerClass : ZPPS.MyRouter,
            viewType : "XML",
            viewPath : "ZPPS.view",
            targetAggregation : "detailPages",
            clearTarget : false
        },
        routes : [
            {
                pattern : "",
                name : "main",
                view : "Master",
                targetAggregation : "masterPages",
                targetControl : "idAppControl",
                subroutes : [
                    {
                        pattern : "{entity}/:tab:",
                        name : "detail",
                        view : "Detail"
                    }
                ]
            },
            {
                pattern : "",
                name : "main",
                view : "Master",
                targetAggregation : "masterPages",
                targetControl : "idAppControl",
                subroutes : [
                    {
                        pattern : "{entity}/:tab:",
                        name : "placeDetail",
                        view : "PlaceDetail"
                    }
                ]
            },
            {
                pattern : "",
                name : "main",
                view : "Master",
                targetAggregation : "masterPages",
                targetControl : "idAppControl",
                subroutes : [
                    {
                        pattern : "{entity}/:tab:",
                        name : "vehicleDetail",
                        view : "VehicleDetail"
                    }
                ]
            },
            {
                name : "catchallMaster",
                view : "Master",
                targetAggregation : "masterPages",
                targetControl : "idAppControl",
                subroutes : [
                    {
                        pattern : ":all*:",
                        name : "catchallDetail",
                        view : "NotFound",
                        transition : "show"
                    }
                ]
            }
        ]
    }
1

1 Answers

1
votes

You have to use the greedy functionality of crossroads. The router is basically a thridparty-lib called crossroads wrapped in a SAPUI5-Class.

the default implementation has the greedy option disabled. That means the router goes through your routes and takes the first route that matched... and thats it.

with greedy option you tell the router to search for all matching pattern and not only the first.

take this router as example how to enable greedy option: http://ui5.de/core/Router.js