Hi UI5-Developers,
I created a List Report Application with Fiori Elements and then made a few changes with the annotation modeller.
Now I am trying to implement an header extension for the Object Page which looks like this:
The view shall implement the URLHelper library and bind the actual data of the odata model used by the application. (https://ui5.sap.com/#/api/sap.m.URLHelper). The screenshot displays the example from the API with a draft JSONModel.
My intention is to bind the view to the context of the Object Page so that I can bind the mail address of that object and using the list as a way of hyperlinking the mail address.
Now I am basically wondering how I use my odata model in the extension controller.
To do that I thought of using the extensionAPI like this post states https://answers.sap.com/questions/12690603/how-can-i-get-the-model-data-of-the-object-page-in.html. However, right at the start, I am getting following error code when trying to use the extensionAPI object:
The Reference does not seem to be wrong, since I am reaching the functions defined by the API under sources in my dev tools.
Controller Code:
sap.ui.define([ "sap/ui/core/mvc/Controller", "sap/ui/model/json/JSONModel", "sap/suite/ui/generic/template/ObjectPage/extensionAPI/ExtensionAPI" ], function (Controller, JSONModel, extensionAPI) { "use strict"; return Controller.extend("namespace.ext.controller.CommunicationExtension", { onInit: function (evt) { var oModel = new JSONModel({ "SupplierCollection": [{ "Tel": "+49 6227 747474", "Sms": "+49 173 123456", "Email": "john.smith@sap.com" }] }); this.getView().setModel(oModel); }, onAfterRendering: function (evt) {
// raises type Error -> this.extensionAPI is undefined this.extensionAPI.getViewId(); }
Thank you very much for your help.