SAPUI5 routing and cross navigation

1.6k Views Asked by At

I want to navigate in my app and make cross app navigation.

In my manifest.json i have got a "routerClass" : "sap.m.routing.Router" when i define this class, my internal navigation works fine but cross navigation between app doesn't work anymore (the url change, but the navigation never happened - i must refresh to go on the right page).

if i change this class, the back button go always to the first page instead of the last page visited, but the cross navigation works fine.

Could you help me ?

Here is my code :

Manifest.json

        "routing": {
            "config": {
                "routerClass": "sap.m.routing.Router",
                "viewType": "XML",
                "viewPath": "JoskinEngineItem.view",
                "controlId": "app",
                "controlAggregation": "pages",
                "transition": "slide",
                "fullWidth": true,
                "clearTarget": false,
                "clearAggregation": false
            },
            "routes": [
                {
                    "pattern": "",
                    "name": "index",
                    "target": "index"
                },
                {
                    "pattern": "indexlevel/{key}",
                    "name": "indexlevel",
                    "target": "indexlevel"
                },
                {
                    "pattern": "search/{key}",
                    "name": "search",
                    "target": "search"
                },
                {
                    "pattern": "class/{key}",
                    "name": "class",
                    "target": "class"
                },
                {
                    "pattern": "production/{key}",
                    "name": "production",
                    "target": "production"
                }
            ],
            "targets": {
                "index": {
                    "viewName": "Index",
                    "viewId": "index",
                    "viewLevel": 1
                },
                "indexlevel": {
                    "viewName": "indexlevel",
                    "viewId": "indexlevel",
                    "viewLevel": 2
                },
                "search": {
                    "viewName": "Search",
                    "viewId": "search",
                    "viewLevel": 5,
                    "transition": "flip"
                },
                "class": {
                    "viewName": "Class",
                    "viewId": "class",
                    "viewLevel": 3
                },
                "production": {
                    "viewName": "Production",
                    "viewId": "production",
                    "viewLevel": 4
                }
            }
        },

Cross app navigation

    var oCrossAppNavigator = sap.ushell.Container.getService("CrossApplicationNavigation");

    var hash = (oCrossAppNavigator && oCrossAppNavigator.hrefForExternal({
    target: {
    semanticObject: "Link",
    action: "Display"
    }
    })) || "";
    oCrossAppNavigator.toExternal({target: {shellHash: hash}});
0

There are 0 best solutions below