SAPUI5 routing Single Master to Multiple Details

妖精的绣舞 提交于 2019-12-13 19:15:54

问题


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:


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



来源:https://stackoverflow.com/questions/28948375/sapui5-routing-single-master-to-multiple-details

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!