Skip to Content
author's profile photo Former Member
Former Member

SAPUI5 Extend - override method in a controller

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)

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 11, 2016 at 08:15 PM

    Thank you for your reply Thomas,

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

    Regards

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 09, 2016 at 11:57 AM

    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;
    	}
    
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.