Mastering Ext JS Second Edition Groner Loiane 2024 Scribd Download
Mastering Ext JS Second Edition Groner Loiane 2024 Scribd Download
com
https://textbookfull.com/product/mastering-ext-js-
second-edition-groner-loiane/
https://textbookfull.com/product/mastering-ext-js-1st-edition-loiane-
groner/
textbookfull.com
https://textbookfull.com/product/javascript-regular-expressions-1st-
edition-groner-loiane-manricks-gabriel/
textbookfull.com
https://textbookfull.com/product/instant-ext-js-starter-1st-edition-
bhava-nagarajan/
textbookfull.com
https://textbookfull.com/product/hagenberg-business-process-modelling-
method-1st-edition-felix-kossak/
textbookfull.com
Rethinking Bail: Court Reform or Business as Usual? Max
Travers
https://textbookfull.com/product/rethinking-bail-court-reform-or-
business-as-usual-max-travers/
textbookfull.com
https://textbookfull.com/product/principles-of-seismology-agustin-
udias/
textbookfull.com
https://textbookfull.com/product/lonely-planet-pocket-stockholm-
ohlsen/
textbookfull.com
https://textbookfull.com/product/advantages-and-pitfalls-of-pattern-
recognition-selected-cases-in-geophysics-volume-3-1st-edition-horst-
langer/
textbookfull.com
https://textbookfull.com/product/the-right-of-self-determination-of-
peoples-the-domestication-of-an-illusion-first-english-edition-fisch/
textbookfull.com
Lesson Plans to Train Like You Fly a flight instructor s
reference for scenario based training Mcmahon
https://textbookfull.com/product/lesson-plans-to-train-like-you-fly-a-
flight-instructor-s-reference-for-scenario-based-training-mcmahon/
textbookfull.com
Mastering Ext JS
Second Edition
Loiane Groner
BIRMINGHAM - MUMBAI
Mastering Ext JS
Second Edition
All rights reserved. No part of this book may be reproduced, stored in a retrieval
system, or transmitted in any form or by any means, without the prior written
permission of the publisher, except in the case of brief quotations embedded in
critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy
of the information presented. However, the information contained in this book
is sold without warranty, either express or implied. Neither the author nor Packt
Publishing, and its dealers and distributors will be held liable for any damages
caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.
ISBN 978-1-78439-045-7
www.packtpub.com
Credits
Reviewers Proofreaders
Peter Holcomb Simran Bhogal
Girish Srivastava Maria Gould
Thorsten Suckow-Homberg Paul Hindle
Copy Editor
Sarang Chari
About the Author
Loiane has worked at multinational companies, such as IBM. Her areas of expertise
include Java SE and Java EE and also Sencha technologies (Ext JS and Sencha
Touch). Nowadays, Loiane works as a software development manager at a financial
institution, where she manages overseas solutions. She also works as an independent
Sencha consultant and coach.
Loiane is also the author of Ext JS 4 First Look, Mastering Ext JS, Sencha Architect App
Development, and Learning JavaScript Data Structure and Algorithms, all published by
Packt Publishing.
She is passionate about Sencha and Java; she is a leader of Campinas Java Users
Group (CampinasJUG) and a coordinator of Espirito Santo Java Users Group
(ESJUG), both Brazilian JUGs.
Loiane also contributes to the software development community through her blogs,
http://loianegroner.com (English) and http://loiane.com (Portuguese-
BR), where she writes about IT careers, Ext JS, Sencha Touch, PhoneGap, Spring
Framework, and general development notes, as well as publishing screencasts.
I also would like to thank the readers of this book and the other books I have written,
for their support and feedback. Your feedback is very valuable to me to improve as
an author and as a professional. Thank you very much!
About the Reviewers
Peter Holcomb has been working with Ext JS for several years, right from version
2, and has thoroughly enjoyed being a part of the Sencha community as it has grown.
A tinkerer at heart, Peter tries to spend his free time on a variety of projects to keep
his skills sharp and stay on top of new frameworks and technologies. He's currently
a lead frontend engineer at SailPoint Technologies, Inc., a company that he's been
fortunate to be a part of for over 8 years. He lives in Austin with his wife, Courtney,
and two children and thoroughly enjoys breakfast tacos.
Did you know that Packt offers eBook versions of every book published, with PDF
and ePub files available? You can upgrade to the eBook version at www.PacktPub.
com and as a print book customer, you are entitled to a discount on the eBook copy.
Get in touch with us at [email protected] for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign
up for a range of free newsletters and receive exclusive discounts and offers on Packt
books and eBooks.
TM
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital
book library. Here, you can search, access, and read Packt's entire library of books.
Why subscribe?
• Fully searchable across every book published by Packt
• Copy and paste, print, and bookmark content
• On demand and accessible via a web browser
[ ii ]
Table of Contents
[ iii ]
Table of Contents
[ iv ]
Table of Contents
[v]
Table of Contents
[ vi ]
Preface
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.
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.
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 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.
[2]
Preface
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.
• Xampp: http://www.apachefriends.org/en/xampp.html
• MySQL: http://dev.mysql.com/downloads/mysql/
• MySQL Workbench: http://dev.mysql.com/downloads/tools/
workbench/
• MySQL Sakila sample database: http://dev.mysql.com/doc/index-
other.html and http://dev.mysql.com/doc/sakila/en/index.html
For Sencha Cmd and the required tools, use the following:
[3]
Preface
• Compass: http://compass-style.org/
• Java JDK (version 7 or later): http://www.oracle.com/technetwork/java/
javase/downloads/index.html
• Java environment variables: http://docs.oracle.com/javase/tutorial/
essential/environment/paths.html
• Apache ANT: http://ant.apache.org/bindownload.cgi
• Apache ANT environment variable: http://ant.apache.org/manual/
install.html
• And of course, Ext JS: http://www.sencha.com/products/extjs/
Conventions
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."
When we wish to draw your attention to a particular part of a code block, the
relevant lines or items are set in bold:
Ext.application({
name: 'Packt',
extend: 'Packt.Application',
[4]
Preface
autoCreateViewport: 'Packt.view.main.Main'
});
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."
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.
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 www.packtpub.com/authors.
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.
[5]
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
Preface
Errata
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 http://www.packtpub.
com/submit-errata, 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.
Piracy
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.
We appreciate your help in protecting our authors and our ability to bring you
valuable content.
Questions
If you have a problem with any aspect of this book, you can contact us at
[email protected], and we will do our best to address the problem.
[6]
Sencha Ext JS Overview
Nowadays, there are many flavors for frontend frameworks and libraries in the
market. There are frameworks you can use if you only want to manipulate the
Document Object Model (DOM), frameworks used only for styling, frameworks for
user-friendly components, frameworks used to design your project, and so on. Also
there is Ext JS, a framework used to create Rich Internet Applications (RIA), but it
has many other features than just pretty components.
In this book, we are going to learn how to develop an application from the beginning
to the end with Ext JS 5, also covering some pieces of the backend required to make
our application work. We will learn how to use Ext JS with hands-on examples
covering some components, how they work, and how to use them in each chapter.
But first, you are going to learn what Ext JS is capable of if this is the first time you
have come into contact with the framework.
Amazingly, the answer is positive to all the preceding questions! As we can see, Ext
JS is a complete frontend framework. The mastermind company behind Ext JS is
Sencha Inc. (http://sencha.com).
Sencha Ext JS Overview
Sencha Ext JS also has a cousin called Sencha Touch. It also has the amazing features
we just mentioned, but focuses on the mobile cross-platform world. We will talk very
briefly about Ext JS and Sencha Touch in later chapters of this book.
Usually, we want to use MySQL, Oracle, MS Server or any other database. To be able
to store information in a database, we need to use a server-side language, such as
PHP, Java, C#, Ruby, Python, Node.js, and so on. Ext JS will communicate with the
server-side language (or web services), and the server will connect to the database or
any other storage (documents repository, for example).
User
PHP/Java/ASP.NET/Python/Ruby
(frameworks)
[8]
Chapter 1
Ext JS overview
We have already mentioned some Ext JS capabilities. Let's take a brief look at each
one of them. But first, if you want to take a look at the official Sencha Ext JS webpage,
visit http://www.sencha.com/products/extjs/.
Basic tutorial
Before diving into this book, it is recommended that you read the contents of the
following links. They contain the basic information that any developer needs
to learn before starting with Ext JS:
Class system
Ext JS uses an object-oriented (OO) approach. We declare classes with attributes
known in Ext JS as configurations and methods (functions in JavaScript).
Ext JS also follows a naming convention. If you are familiar with OO programming,
you are probably familiar with the naming conventions of Ext JS as well. For
example, class names are alphanumeric, starting with an uppercase character, and
and then the rest of the letters are in CamelCase. For example, if we want to create a
class to represent the client details, we could name it ClientDetails. Method and
attribute names start with a lowercase character and then the rest of the letters are in
CamelCase. For example, retrieveClientDetails() is a good name for a method
and clientName is a good name for an attribute.
Ext JS is organized in packages as well. Packages are a way of organizing the code
that has the same purpose. For example, in Ext JS, there is a package called data that
handles everything related to data in the framework. There is a packaged named
grid that contains all the code related to GridPanels.
[9]
Sencha Ext JS Overview
For more information about the class system, please read http://docs.
sencha.com/extjs/5.0/core_concepts/classes.html.
Components
The main reason some people consider using Ext JS is probably because of its rich and
user-friendly components. Ext JS contains some of the most used components in web
applications, such as forms, grids, and trees. We can also use charts that are touch-
friendly (meaning they work on touchscreens as well) and the drawing package that
uses all the advantages of Scalable Vector Graphics (SVG) and HTML5.
You can checkout the official Sencha Ext JS examples page at http://dev.sencha.
com/extjs/5.0.0/examples/index.html to have an idea of what we can do with
the examples.
Component
Tool
LoadMask
Button Container
Viewport Toolbar
Panel
TabPanel Window
Menu
Table
Form
Grid Tree
[ 10 ]
Random documents with unrelated
content Scribd suggests to you:
I WAS not with the rest at play;
My brothers laughed in joyous mood:
But I—I wandered far away
Into the fair and silent wood;
And with the trees and flowers I stood,
As dumb and full of dreams as they:
—For One it seemed my whole heart knew,
Or One my heart had known long since,
Was peeping at me through the dew;
And with bright laughter seemed to woo
My beauty, like a Fairy prince.