You can replace standard object page table navigation with custom navigation to external or internal targets using controller extensions in SAP Fiori elements for OData V2.
Use app extensions with caution and only if you cannot produce the required behavior by other means, such as manifest settings or annotations. To correctly integrate your app extension coding with SAP Fiori elements, use only the
extensionAPIof SAP Fiori elements. For more information, see Using the extensionAPI.After you've created an app extension, its display (for example, control placement and layout) and system behavior (for example, model and binding usage, busy handling) lies within the application's responsibility. SAP Fiori elements provides support only for the official
extensionAPIfunctions. Don't access or manipulate controls, properties, models, or other internal objects created by the SAP Fiori elements framework.
-
Add a navigation target to the
manifest.jsonfile.The following sample code shows how an external navigation or outbound navigation is added using the SAP Fiori launchpad.
manifest.jsonsap.app": { ... "crossNavigation": { "inbounds": {}, "outbounds": { "EPMProductManageSt": { "semanticObject": "EPMProduct", "action": "manage", "parameters": { "preferredMode": { "value": { "value": "display" } } } } } } .... -
Register your extension in the
manifest.jsonfile.manifest.json"extends": { "extensions": { ... "sap.ui.controllerExtensions": { ... "sap.suite.ui.generic.template.ObjectPage.view.Details": { ... "controllerName": "STTA_MP.ext.controller.DetailsExtension", ... } } ... -
Implement your controller extension.
You have to implement the
onListNavigationExtensionfunction within the object page controller extension.onListNavigationExtension: function(oEvent) { var oNavigationController = this.extensionAPI.getNavigationController(); var oBindingContext = oEvent.getSource().getBindingContext(); var oObject = oBindingContext.getObject(); // for notebooks we trigger external navigation for all others we use internal navigation if (oObject.ProductCategory == "Notebooks") { oNavigationController.navigateExternal("EPMProductManageSt"); } else { // return false to trigger the default internal navigation return false; } // return true is necessary to prevent further default navigation return true; },