Book Image

Mastering ExtJS - Second Edition

By : Loiane Avancini
Book Image

Mastering ExtJS - Second Edition

By: Loiane Avancini

Overview of this book

Table of Contents (19 chapters)
Mastering Ext JS Second Edition
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

The Films ViewController


In past chapters, we have already covered some examples of how to save data. We used the form submit, an Ajax request, and also the writing resource from the Store. In this chapter, let's focus on functionalities we have not implemented yet. Do not worry. The complete implementation is available within the source code distributed with this book.

The createDialog method

We created all the views for our application. In the base ViewController, we created the handlers for the Add and Edit buttons, and both call the createDialog method, which we are going to develop now.

The idea is to display a blank Edit window in case the user clicks on the Add button, and to display the selected film in case the user clicks on the Edit button. The source code for this method is as follows:

createDialog: function(record){

    var me = this,
        view = me.getView(),        //#1
        glyphs = Packt.util.Glyphs;

    me.isEdit = !!record;           //#2
    me.dialog = view.add(...