on 07-21-2020 10:28 PM
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.
Hello Marcel,
When you do a break out code there are multiple controllers which can come in to the context. For an example in case you have View extension, you could have a controller associated to this view extension. This is pure UI5 logic and Fiori elements doesn't play any role in this. You could also have an Extension controller to the standard view of LR/ALP/OP Component. The extensionAPI object is associated with the Standard components extension controller. From your controller extension code it looks to me is a View extension and that is why you don't have this reference.
Regards,
Vinod
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.