Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Receive the attribute component from the controller.

Hello!

Please tell me where I'm wrong.

I have created a component multiple angles and multiple controllers. I added an attribute 'main_data' to the component.

If I call this attribute in the code fragment, everything works correctly.

MonoTable_Edit.fragment.js

sap.ui.jsfragment("sap.ui.....forms.view.MonoTable_Edit", {

  createContent: function(oController) {

  var oDFC = oController.getOwnerComponent().main_data;

  ...

If I call this attribute in the code of the controller, the console browser (FireFox) I get the error:

"TypeError: this.getOwnerComponent is not a function"

MonoTable.controller.js

addNewEntry: function(){

  var o_entry;

  var component;

  component = this.getOwnerComponent();

  o_entry = component.main_data.output.lines[0];

  ...

Tell me, how else can you turn to the component from controller?

Tags:
Former Member
replied

SAPUI5 SDK - Demo Kit

press: jQuery.proxy(oController.testMethod  , oController)



or


press: [oController.testMethod  , oController]

1 View this answer in context
Not what you were looking for? View more on this topic or Ask a question