cancel
Showing results for 
Search instead for 
Did you mean: 

Fiori Elements: Controller Extension not loaded

htammen
Active Contributor

Hi,

I have a Fiori Elements ListReport/ObjectPage app and want to extend the controller of the ObjectPage.

Hence I added this to the manifest.json

"sap.ui5": {
   ... 
   "extends": {
      "extensions": {
        "sap.ui.controllerExtensions": {
          "sap.suite.ui.generic.template.ObjectPage.view.Details": {
            "controllerName": "de.tammenit.portal.ui.stammdaten.ext.Custom"
          }
        }
      }
    }
   ...
}

In folder "webapp/ext" I created a file "Custom.controller.js" with this content

sap.ui.define([], function() {
  "use strict";
  return {
     onInit : function () {
          console.log("samples.components.ext.customer.CustomMain - onInit");
      },

      doSomething: function() {
          alert("this is a customer action");
      }
  }
});

When I run the application I would expect that my custom controller is merged into the ObjectPage.view.Details controller.

But my controller is not loaded and hence the onInit method is never called.

I also tried the "Controller Extension" approach described here: https://sapui5.hana.ondemand.com/#/topic/21515f09c0324218bb705b27407f5d61.html with no success.

Any suggestions?

Thanks Helmut

boghyon
Product and Topic Expert
Product and Topic Expert
0 Kudos

Could you tell us since which SAPUI5 version the approach failing? Or is it failing in all versions?
Other app devs seem to experience similar issues.

htammen
Active Contributor
0 Kudos

I don't know since when it is failing. I use the newest version 1.99.0

former_member846754
Discoverer
0 Kudos

same issue with you, as mentioned in ui5 website, controller extension could be as a plain object which define by sap.ui.define(). but when i run my extension project, the extHookChangeFilterItems in original controller still remain null, never implemented, have you got the answer now? if yes, could you please guide me.

0 Kudos

Hi, I also created the ui5 version 1.71.55, smart template List report project. I am facing the error after 4 th time running in Webide error:

I raised SAP incident and they have no idea on this issue. tried this note details: https://userapps.support.sap.com/sap/support/knowledge/en/3102930.
console-error-for-list-report.jpg
Please do check and help me to fix this issue.
Thanks, Soumya

Attila
Active Participant
0 Kudos

Hi soumyar ,

as I saw You recently faced this issue, please try as explained by Vladislav already. So try to define Your extension controller like this, with the "old" approach. In case this is an older WebIDE OData V2 template project this.getView().byId should work with the below controller definition.

sap.ui.controller("namespace.appId.ext.controller.ListReportExt", {

/**
* View initialization
*/
onInit: function () {
let smartTable = this.getView().byId("listReport");

if (smartTable && smartTable.getMetadata().getName() === 'sap.ui.comp.smarttable.SmartTable') {

}
}
});

Best regards

Attila

0 Kudos

Hi Attila, got my issue resolved with variable definition was at wrong place. This was causing the controller code not defined within the required format. Thank you, Soumya

AlexGourdet
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello luos,

Please consider this as an opportunity to capture your data to start a new question thread rather than posting your question as an answer which I converted to comment so you can get a chance to copy it over to a new thread.

regards,

Alex

View Entire Topic
SureshRa
Active Participant
0 Kudos

I don't see anything wrong in your extension controller. This extension controller will load only when you navigate to the Object Page for the first time. If you are expecting this extension controller to load when you load the app, it won't as it is meant to extend Object Page view controller.

htammen
Active Contributor
0 Kudos

Thanks for the answer suresh.radhakrishnan,

as you mentioned I assume the onInit function to be called the first time I navigate to the Object Page. This does not work in my application. But if it works on your side I might have another problem. Will look into it a bit deeper.