How does the UI5 ​​Control life cycle work?

Can someone give a more detailed explanation of the default event life cycle for UI5 Control? I know that this page in the documentation gives an overview of the Control life cycle, however I think it is very brief and requires something more detailed. Can someone list the order of the Control events and explain what each event does? Thanks in advance!

+4
source share
2 answers

You are absolutely right. Details of the management life cycle and implementation details are very well hidden in the documents. I will try to summarize my understanding so far.

The life cycle of a control is primarily determined by:

:

sap.ui.core.Control.extend("a.sample.Control", {
  init : function() {
    // instantiate a sub-control
    this._btn = new sap.m.Button(); 
  },

  onBeforeRendering : function() {
    // deregister a listener via jQuery
    this.$("subelement").off("click", this.subElementClick);
  },

  onAfterRendering : function() {
    // register a listener via jQuery on a sub-element
    this.$("subelement").on("click", this.subElementClick);
  },

  subElementClick : function() {
    // do stuff
  },

  exit : function() {
    // clean up sub-controls and local references
    this._btn.destroy();
    delete this._btn;
  }

});

init ?

UI5 ManagedObject. "" UI5 init. , init , , .

rerender?

SAPUI5 , . rerender , invalidate .

+14

SAPUI5 . , , .

SAPUI5 :

onInit(): , , ( ) ;

onExit(): ; .

onAfterRendering(): , , HTML ; - HTML. SAPUI5 .

onBeforeRendering(): , ; onInit() hook

+1

All Articles