This is the life cycle of a control in SAPUI5.
Knowing the life cycle is needed to use the life cycle hooks.
So if you want to learn the life cycle and how to use its hooks, then this article is for you.
Let’s get started!
Life Cycle of a Control in SAPUI5 and Its Life Cycle Hooks
SAPUI5 has several life cycle hooks built into its controls. The SAPUI5 framework calls those life cycle hooks automatically at certain points of the SAPUI5 control’s life cycle.
SAPUI5’s life cycle hook methods and therefore, its life cycle is:
- onInit: Called after the init method of the inherited element is invoked. Initializes the control after creation.
- onBeforeRendering: Just before the control starts rendering. Called before every render or re-render.
- onAfterRendering: After the control has been rendered. Called after every rendering and re-rendering.
- onExit: Called after the destroy method of the inherited element is executed. Cleans up the control instance before destruction.
Here is a controller’s life cycle in SAPUI5.
And here’s the order an application executes in SAPUI5.