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
About the Author
About the Reviewers


If you are an Ext JS developer, it probably took you a while to learn the framework. We know that the Ext JS learning curve is not short. After we have learned the basics, and we need to use Ext JS in our daily jobs, a lot of questions pop up: how can one component talk to another? What are the best practices? Is it really worth using this approach and not another one? Is there any other way I can implement the same feature? This is normal.

This book was written thinking about these developers.

So this is what this book is about: how do we put everything together and create really nice applications with Ext JS? We are going to create a complete application, from the mockup of the screens all the way to putting it into production. We are going to create the application structure, a splash screen, a login screen, a multilingual capability, an activity monitor, a dynamic menu that depends on user permission, and modules to manage database information (simple and complex information). And then, we will learn how to build the application for production, how to customize the theme, and how to debug it.

We will use real-world examples and see how we can implement them using Ext JS components. And throughout the book, we've also included a lot of tips and best practices to help you boost your Ext JS knowledge and take you to the next level.

What this book covers

Chapter 1, Sencha Ext JS Overview, introduces Sencha Ext JS and its capabilities. This chapter provides references that you can read before diving into the other chapters of this book. This is done taking into consideration the possibility that this is your first contact with the framework.

Chapter 2, Getting Started, introduces the application that is implemented throughout the book, its features, and the mockup of each screen and module (each chapter covers a different module), and also demonstrates how to create the structure of the application using Sencha Cmd and how to create a splash screen.

Chapter 3, The Login Page, explains how to create a login page with Ext JS and how to handle it on the server side and also shows some extra capabilities, such as adding the Caps Lock warning message and submitting the login page when pressing the Enter key.

Chapter 4, The Logout and Multilingual Capabilities, covers how to create the logout capability and also the client-side activity monitor timeout, which means if the user does not use the mouse or press any key on the keyboard, the system ends the session automatically and logs out. This chapter also provides an example of multilingual capability and shows how to create a component so that the user can use it to change the system's language and locale settings.

Chapter 5, Advanced Dynamic Menu, is about how to create a dynamic menu that depends on user permission. The options of the menu are rendered depending on whether the user has permission or not; if not, the option will not be displayed.

Chapter 6, User Management, explains how to create a screen to list all the users that already have access to the system.

Chapter 7, Static Data Management, covers how to implement a module where the user is able to edit information as though they were editing information directly from a MySQL table. This chapter also explores capabilities such as live search, filter, and inline editing (using the Cell Editing and Row Editing plugins). Also, we start exploring real-world issues when we develop big applications with Ext JS, such as the reuse of components throughout the application.

Chapter 8, Content Management, further explores the complexity of managing information from a table of the database and all its relationships with other tables. So we cover how to manage complex information and how to handle associations within data Grids and FormPanels.

Chapter 9, Adding Extra Capabilities, covers how to add features, such as printing and the ability to export to PDF and Excel, that are not supported natively by Ext JS. This chapter also covers charts and how to export them to image and PDF and also how to use third-party plugins.

Chapter 10, Routing, Touch Support, and Debugging, demonstrates how to enable routing in the project; it is also about debugging Ext JS applications, including what we need to be careful about and why it is very important to know how to debug. We also quickly talk about transforming Ext JS projects into mobile apps (responsive design and touch support), a few helpful tools that can help you in your daily work as a developer, and also a few recommendations of where to find extra and open source plugins to use in Ext JS projects.

Chapter 11, Preparing for Production and Themes, covers how to customize a theme and create custom UIs. It also explores the steps required for, and the benefits of, packaging the application to production.

What you need for this book

The following is a list of the software you will need to have installed prior to executing the examples of the book. The following list covers the exact software used to implement and execute the examples of this book, but you can use any similar software that you already have installed that has the same features.

For a browser with a debugger tool, use the following:

  • Firefox with Firebug: and

  • Google Chrome:

For a web server with PHP support, use the following:

  • Xampp:

For the database, use the following:

  • MySQL:

  • MySQL Workbench:

  • MySQL Sakila sample database: and

For Sencha Cmd and the required tools, use the following:

  • Sencha Cmd:

  • Ruby 1.8 or 1.9:

  • Sass:

  • Compass:

  • Java JDK (version 7 or later):

  • Java environment variables:

  • Apache ANT:

  • Apache ANT environment variable:

  • And of course, Ext JS:

We will use Ext JS 5.0.1 in this book.

Who this book is for

If you are a developer who is familiar with Ext JS and want to augment your skills to create even better web applications, this is the book for you. Basic knowledge of JavaScript/HTML/CSS and any server-side language (PHP, Java, C#, Ruby, or Python) is required.


In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "If we want to create a class to represent the client details, we could name it ClientDetails."

A block of code is set as follows:

Ext.define('', {
    extend: 'Packt.model.staticData.Base', //#1

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

    name: 'Packt',

    extend: 'Packt.Application',
    autoCreateViewport: 'Packt.view.main.Main'

Any command-line input or output is written as follows:

sencha generate app Packt ../masteringextjs

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Scroll until the end of the page and select OPEN SOURCE GPL LICENSING."


Warnings or important notes appear in a box like this.


Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files from your account at for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit and register to have the files e-mailed directly to you.


Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to and enter the name of the book in the search field. The required information will appear under the Errata section.


Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.


If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.