cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 Extend - override method in a controller

Former Member
0 Kudos

Hi experts,

I'm trying to remove the “save as tile” option from “My Leave request “ Fiori App.

First of all I’m trying to extend the S3 controller and I think it’s not working properly. I’m developing using eclipse Neon.

I have included at my Component.js this code:

"sap.ui.controllerExtensions": {

"hcm.myleaverequest.view.S3": {

controllerName : "sie.hrc.hcm.myleaverequest.view.S3_extension"

}

}

And I have created at my view directory of my eclipse project extension the file S3_extension.controler.js with the code:

sap.ui.controller("sie.hrc.hcm.myleaverequest.view.S3_extension", {

onInit : function() {

console.log(".....OnInit.....-S3_extension-** CONTROLLER **");

this.objHdrFtr.bSuppressBookmarkButton = true;

}

}

I cannot see at the console the text I’m trying to send at “onInit” method .

After that I guess I should override the getHeaderFooterOptions method with a code like this:

getHeaderFooterOptions: function(){

var m = new sap.ui.core.routing.HashChanger();

var u = m.getHash();

this.objHdrFtr.bSuppressBookmarkButton = true;

//if (this.extHookChangeFooterButtons) {

//o = this.extHookChangeFooterButtons(o);

//}

return o;

}

Or even the extHookChangeFooterButtons like this:

extHookChangeFooterButtons: function(o){

o.bSuppressBookmarkButton = true;

return o;

}

But since, like I’ve already said, I cannot see the text I’m trying to send to the console so I think my controller extension is not right.

Any help will be really appreciated

(Sorry if I don't select the right tags to classify my question)

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Thank you for your reply Thomas,

we had a namespace problem after solve it, both "pieces of code" work fine for us.

Regards

Answers (1)

Answers (1)

thomas_arnesen
Explorer

Hi there

We had the same requirement and the same issue, when using the extHookChangeFooterButtons method in the extended controller.

When changing "o" nothing happened - this looks like what you've tried:

	extHookChangeFooterButtons: function(o){
    o.bSuppressBookmarkButton = true;
		    		return o;
	}	

But when we used the below it all worked fine:

	extHookChangeFooterButtons: function(o){
    		var _o;
    		_o = o;
    		_o.bSuppressBookmarkButton = true;
		    		return _o;
	}