SAPUI5 extending TextField, PasswordField and Button Control with events

Part 2 of 4. This tutorial will help you learn and understand how to extend a UI5 Button Control with events. Also how to extend a TextField and PasswordField.

You will learn

You will learn how to extend an existing control i.e Button in your application, and how to assign it events to call it as button is one of the most widely used element in a web page, along with TextField and PasswordField for your Login Preview app.

From your previous tutorial in your index.html file between the scripts tag below the extend controller add the following

Events consist of the name of your event and below that is the method to be called when that event is occurred.

The renderer defines the HTML structure that will be added to the DOM tree of your application whenever the control is instantiates in a view. It is usually called initially by the core of SAPUI5 and whenever a property of the control is changed. But in this case you will leave it empty.

Now you will create an object of the extended controls and define the method to be called. This is below the extended control between scripts tag.