A constructor is a special type of function that is called to create an object. The constructor uses values to set control properties, thus preparing the new object for use.
In SAPUI5, control constructors accept the following arguments in the specified order:
The following code snippet shows an example of a constructor that is called to create a new text field "Hello World" with the specified tooltip and width:
var oTextField = new sap.ui.commons.TextField("testTextField", {value : "Hello SAPUI5", tooltip: "This is an example tooltip", width: "100px"});
The above example is an abbreviated version of the following code snippet with a detailed list of statements, which is alternatively supported:
var oTextField = new sap.ui.commons.TextField("testTextField"); oTextField.setValue("Hello SAPUI5"); oTextField.setTooltip("This is an example tooltip"); oTextField.setWidth("100px");
The supported parameters are documented in the JsDoc of the respective control.