cancel
Showing results for 
Search instead for 
Did you mean: 

How to override prototype method of a control

Former Member
0 Kudos

Hi experts,

              Suppose for example,i am using sap.m.Button it already have an event

Button.prototype.ontouchstart = function(oEvent) {

  // mark the event for components that needs to know if the event was handled by the button

  oEvent.setMarked();

  // change the source only when the first finger is on the control, the

  // following fingers doesn't affect

  if (oEvent.targetTouches.length === 1) {

  // set active button state

  this._activeButton();

  // set target which started the event

  this._target = oEvent.target;

  }

  };

If i want to add any new logic of mine inside this function . what should be my approach. I am new to ui5 please help. Dennis Seah's Profile | SCN kindly help.

Accepted Solutions (1)

Accepted Solutions (1)

former_member182862
Active Contributor
0 Kudos

Hi Lahari

You can extend the sap.m.Button like this.

JS Bin - Collaborative JavaScript Debugging

Answers (1)

Answers (1)

saivellanki
Active Contributor
0 Kudos

Hi Lahari,


Add your logic to ontouchstart function.

But ensure that above code needs to be added before the button is created.


Check this thread -

And one more thing, if you want to mention like this - You have to use like this



@Dennis_Seah //For example if you want to mention Dennis Seah


Regards,

Sai Vellanki.