martes, 13 de agosto de 2019

SAPUI5 Controller Lifecycle Events

SAP UI5 events for a view:

Event handlers:
- onPress. Called on press button.

Specific events, which are called “lifecycle hooks”:

- onInit. Colled when the controller is initialized.
- onBeforeRendering. Called before the rendering.
- onAfterRendering. Called when the rendering has already happened on the page
- onExit. Called when the view is closed.

the “lifecycle hooks” are invoked by the UI5 framework at key points in the lifecycle of the application.



Ej. onPress event handler:

In the view.xml:

<Button text="Find Jobs" type="Emphasized" class="sapUiSmallMarginTop" press=".onPress('for jobs')"/>

In the view.controler.js:

sap.ui.define([
    "sap/ui/core/mvc/Controller"
], function (Controller) {
    "use strict";

    return Controller.extend("xxx.controller.MainView", {
        onInit: function () {

        },
        onPress: function (oEvent) {
            sap.ui.require(["sap/m/MessageToast"], function (oMessage) {
                oMessage.show("Hello on press.");
            });
        }
    });
});


 

No hay comentarios:

Publicar un comentario