Creating the ViewController
The missing piece now is the ViewController, which will handle all the handlers and listeners declared in our code. We will split the code into two classes: the base.ViewController
that contains generic code and can be reused, and the film.FilmsController
that contains the code to handle specific details of the Films
View.
The base ViewController
Inside this class, we will put all the generic code that can be reused by other views that have the same behavior as the Films
View. For example, editing or deleting a record by clicking on a button of a Widget Column opens the pop-up window. If the user clicks on the Add button, then close the pop-up window that is used to create or edit information.
The code for this class is presented as follows:
Ext.define('Packt.view.base.ViewController', { extend: 'Ext.app.ViewController', requires: [ 'Packt.util.Util', 'Packt.util.Glyphs' ], onAdd: function(button, e, options){ //#1 this.createDialog...