Show TOC

Methods Controlling the Initial InstantiationLocate this document in the navigation structure

SAPUI5 provides two methods for the initial instantiation of the component.

You can use the following methods:

  • init

    Overwrite this method for example to connect the model between the control and the component. This method is not called by the application directly, but called automatically when you create the instance of the component.

  • createContent

    The createContent method needs to be overwritten within your component implementation. You use this method to place all the code which is required to fill your component with the respective content, for example, creating an instance of the controls that should be used, or connecting the view that should be displayed. For the latter, you simply need to set this view to the view you want to use. See the following code snippet for an example:

    this.view = sap.ui.view({id:"myView",viewName:"samples.components.products.details.view.Details",type:sap.ui.core.mvc.ViewType.JS});