Skip to Content
0

SAPUI5 Extend - override method in a controller

Dec 07, 2016 at 09:00 AM

496

avatar image
Former Member

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)

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
avatar image
Former Member Dec 11, 2016 at 08:15 PM
0

Thank you for your reply Thomas,

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

Regards

Share
10 |10000 characters needed characters left characters exceeded
Thomas Arnesen Dec 09, 2016 at 11:57 AM
0

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;
	}
Share
10 |10000 characters needed characters left characters exceeded