Auto-Wiring for View Panels
Auto-Wiring for View Panels
As with any other JavaScript code, the controller object has full access to the View API and all UI panels and controls. In addition, the Controller automatically has references to all panels as data variables so that if, for example, the view contains
<panel type="form" id="employeeForm">
, the Controller will automatically have an
employeeForm
variable that references the corresponding
Ab.form.Form
panel object. Briefly, we would say that the
employeeForm
panel reference is auto-wired to the controller. Using auto-wiring the example above can be re-written as:
afterViewLoad: function() {
this.employeeForm.newRecord = true;
}
Without "boilerplate" code such as
View.panels.get('employeeForm')
the application logic becomes easier to write, read, and understand.