I have been learning the master-detail demo, below is a snippet in Master.controller.js
onInit : function() {
this.getView().addEventDelegate({
onBeforeFirstShow: function () {
this.getOwnerComponent().oListSelector.setBoundMasterList(oList);
}.bind(this)
});
}
I can not understand that event delegate because I haven't seen onBeforeFirstShow
event is in any control/view API doc.
Is this is a just user-defined event or a pre-defined event?
I have tried
this.getView().addEventDelegate({
onBeforeFirstShow: function () {
console.log("onBeforeFirstShow");
}.bind(this),
onAfterRendering: function () {
console.log("onAfterRendering");
}.bind(this)
});
It seems that it happens before onAfterRendering
. Besides:
this.getView().onAfterRendering
returnedfunction
this.getView().onBeforeFirstShow
returnedundefined
.
I have searched in doc of Controller and View, and source code of sap.ui.core.mvc.Controller and sap.ui.core.mvc.View. There are only four lifecycle methods.
The event
beforeFirstShow
is available for the view because the view is a direct aggregation child ofNavContainer
. Other than that, there are currently alsoafterHide
afterShow
beforeHide
beforeShow
Those events are triggered by
sap.m.NavContainer
on its child controls (in our case, the view) when navigation occurs and child controls are displayed/hidden.