Skip to Content
0
Former Member
Feb 19, 2016 at 01:18 PM

Is there any other way to call the controller's function in the button click event function ?

24 Views

is this only way to call controller's function inside sap.ui.controller("sapcommon.sapcommon").functionToCall();

View

sap.ui.jsview("sapcommon.sapcommon", {

getControllerName : function() {

return "sapcommon.sapcommon";

},

createContent : function(oController) {

var oButton = sap.ui.commons.Button({"text":"Demo"});

return oButton;

}

});

/****************Controller ***************************/

sap.ui.controller("sapcommon.sapcommon", {

onInit: function() {

},

functionToCall : function() {

alert("function called");

},

onButtonPressed : function(event){

sap.ui.controller("sapcommon.sapcommon").functionToCall();

}

Thanks

Kathiresan S