cancel
Showing results for 
Search instead for 
Did you mean: 

My ControllerExtension calls Standard Worklist Controller method works...but with issues

_T_H_E_
Explorer
0 Kudos
118

This is for SAPUI5 adaptation project on ui.ssuite.s2p.mm.pur.pr.prcss.s1.  

I created a ControllerExtension js which overrides CreateButtonsEnableCheck method in the standard Worklist.controller.js.  My intention is to add custom logic while keeping everything in the standard CreateButtonsEnableCheck intact.  In this case, I just wanted to add messagebox.alert message before calling the standard CreateButtonsEnableCheck in the Worklist.controller.js.  

Everything seems to be working.  I was able to see that the messagebox alert gets triggered before calling the standard CreateButtonsEnableCheck in Worklist.controller.js.  HOWEVER, now getSelectedContexts() within the standard CreateButtonsEnableCheck doesn't work anymore.

I'm guessing this is because of how I'm calling the standard CreateButtonsEnableCheck from the override section of my ControllerExtension js:

override: {
CreateButtonsEnableCheck: function(e, i) {
 MessageBox.alert("Button Clicked...");
 ui.ssuite.s2p.mm.pur.pr.prcss.s1.controller.Worklist.prototype.CreateButtonsEnableCheck.apply(this, arguments);
}
}
 
From debugger (fully standard):
notice the function location is controller and it does fine getSelectedContext() successfully.
_T_H_E__0-1739469416804.png

From Debugger (using my controllerextension):

notice functional location is different which causes it not to find getSelectedContext():

_T_H_E__1-1739469510326.png

 Do you have any idea on how to fix this?

Thanks

 

View Entire Topic
junwu
SAP Champion
SAP Champion
0 Kudos

try this.

override: {
CreateButtonsEnableCheck: function(e, i) {

var that=this;
MessageBox.alert("Button Clicked...");
ui.ssuite.s2p.mm.pur.pr.prcss.s1.controller.Worklist.prototype.CreateButtonsEnableCheck.apply(that, arguments);
}
}

_T_H_E_
Explorer
0 Kudos
I've tried that as well. Same results.
junwu
SAP Champion
SAP Champion
how about this? var oController=this.getView().getController(), use oController in that apply call.
_T_H_E_
Explorer
0 Kudos
Thanks! I can't believe that worked: var oController=this.getView().getController()