Auto-Wiring During View Initialization
Auto-Wiring During View Initialization
Two auto-wired events occur during view loading:
afterViewLoad()
and
afterInitialDataFetch()
. The view/panel/controller loading sequence, in simplified form, is:
- Construct all dataSource and panel objects.
- Initialize view state.
- Perform the layout for all panels.
-
Call
afterViewLoad()
methods for all controllers. -
Perform initial data fetch for all panels (panels will refresh themselves unless
panel/@showOnLoad=false
). -
Call
afterInitialDataFetch()
methods for all controllers.
For example, in order to force a panel to refresh again (presumably after setting a restriction), you should do it in the
afterInitialDataFetch()
controller method, and not in
afterViewLoad()
:
var enterTabController = View.createController('enterTabController', {
afterInitialDataFetch: function() {
this.activityForm.refresh();
},
activityForm_afterRefresh: function(){
this.activityForm.actions.get('enterSubmit').forceDisable(true);
}
});
Also consider setting the
panel/@showOnLoad
to false, to avoid the unnecessary initial data fetch from the server for this panel.