Instant download Learning ExtJS - Fourth Edition Carlos Méndez pdf all chapter
Instant download Learning ExtJS - Fourth Edition Carlos Méndez pdf all chapter
com
https://textbookfull.com/product/learning-extjs-fourth-
edition-carlos-mendez/
OR CLICK BUTTON
DOWNLOAD NOW
https://textbookfull.com/product/college-accounting-a-contemporary-
approach-fourth-edition-m-david-haddock/
textboxfull.com
https://textbookfull.com/product/applied-machine-learning-1st-edition-
m-gopal/
textboxfull.com
https://textbookfull.com/product/data-mining-practical-machine-
learning-tools-and-techniques-fourth-edition-ian-h-witten/
textboxfull.com
https://textbookfull.com/product/agent-based-modeling-of-social-
conflict-from-mechanisms-to-complex-behavior-1st-edition-carlos-m-
lemos-auth/
textboxfull.com
Learning Java Functional Programming 1st Edition Reese
Richard M
https://textbookfull.com/product/learning-java-functional-
programming-1st-edition-reese-richard-m/
textboxfull.com
https://textbookfull.com/product/deep-learning-applications-
volume-2-m-arif-wani/
textboxfull.com
https://textbookfull.com/product/learning-network-programming-with-
java-1st-edition-reese-richard-m/
textboxfull.com
https://textbookfull.com/product/functional-training-1st-edition-juan-
carlos-santana/
textboxfull.com
https://textbookfull.com/product/intelligent-computing-systems-carlos-
brito-loeza/
textboxfull.com
Learning Ext JS
Fourth Edition
Carlos A. Méndez
Crysfel Villa
Armando Gonzalez
BIRMINGHAM - MUMBAI
Learning Ext JS
Fourth 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 authors, 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-438-7
www.packtpub.com
Credits
Authors Copy Editors
Carlos A. Méndez Vikrant Phadke
Crysfel Villa Angad Singh
Armando Gonzalez Ameesha Smith-Green
Commissioning Editor
Ashwin Nair Indexer
Tejal Daruwale Soni
Acquisition Editor
Shaon Basu Production Coordinator
Manu Joseph
Technical Editor
Menza Mathew
About the Authors
Trying to explore creativity with a deep passion, Carlos has created many Ext JS
components and VB components for private companies and was also involved
in graphic design, such as illustrations and small animations used for interactive
presentations by some companies in México. He always has a passion for creating
and learning new things on the Web.
First of all, I would like to thank my mother and brother for their
support and help in realizing this project. Thanks to my best friend,
Nacir Garcia Junior, for his support and friendship over these last
years. Also, thanks to my father and uncles, whose challenges,
work pressures, and work and personal knowledge were passed on
through all these years in matters of design and business logic. These
have brought me where I am today. Without all you guys, I would
not have been able to accomplish many achievements and goals.
Thanks, everybody!
Crysfel Villa is a software engineer with more than 8 years of experience with
JavaScript. He started his career as a web developer working with HTML and basic
JavaScript in the late 1990s but then started focusing on server-side technologies,
such as PHP and Java J2EE.
Before he started working with the Ext JS library, he loved to work with MooTools,
but in late 2007, he started learning about an awesome new library that was
emerging as an open source project. At that time, version 2.0 of the Ext JS library had
just been released, and Crysfel started using this new library for medium-to-large
projects in the agency that he used to work for.
More recently, Crysfel has been getting into new technologies such as Angular JS
and React Native. If you want to find out more about his work, you can follow him
on Twitter (@crysfel) or download his open source projects from GitHub (crysfel).
Writing this book was very hard, especially when you are a busy
person and really like to get involved in exciting things. I want to
give special thanks to my wife, Hazel, who supported me in every
step of the process. Without her, this wouldn't have been possible.
She read all the scripts before I submitted them. She usually found
some mistakes or things to clarify. Her work on this project
is priceless.
In 2011, Olivier left a full-time job as a Delphi and PHP developer to concentrate on
his own company, HQF Development (http://hqf.fr). He currently runs a number
of websites, including http://krystallopolis.fr, http://artsgaleries.com,
http://www.battlesoop.fr, http://www.livrepizzas.fr, http://www.
papdevis.fr, and http://olivierpons.fr, which is his own web development
blog. He's currently learning Unity and building a game on his own. He works as a
consultant, teacher, and project manager and sometimes helps major companies as a
senior/highly skilled developer.
Juris Vecvanags started a career in the IT field in early 90s. At that time, he had
the chance to work with a broad range of technologies and share his knowledge with
Fortune 500 companies as well as private and government customers.
When it comes to web technologies, this invaluable experience serves as his ground
to be a trusted advisor and competent reviewer. When Juris is away from the office,
you can find him speaking at meetups in the San Francisco Bay Area, Chicago, and
New York. Among the topics he covers are Node.js, Ext JS, and Sencha Touch.
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 service@packtpub.com for more details.
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
[i]
Table of Contents
Configurations 40
Statics methods and properties 43
Explanation 45
The Singleton class 46
Aliases 47
Loading classes on demand 50
Enabling the loader 51
Working with the DOM 52
Getting elements 53
Query – how do we find them? 55
DOM manipulation – how do we change it? 57
Summary 59
Chapter 3: Components and Layouts 61
The component life cycle 61
The initialization phase 63
The rendering phase 66
The destruction phase 69
The life cycle in action 70
About containers 73
Types of containers 78
The viewport 78
The panel 79
Panels versus containers 80
The Window component 81
The layout system 82
The Border layout 82
The Fit layout 84
The Card layout 85
The Accordion layout 86
The Anchor layout 87
More layouts 89
Comments about using layouts 89
Summary 91
Chapter 4: It's All about the Data 93
Ajax 94
Passing parameters to an Ajax request 98
Setting timeout for Ajax request calls 99
[ ii ]
Table of Contents
Models 100
Mappings 103
Validators 105
Custom field types 108
Relationships 110
One-to-many associations 111
One-to-one associations 113
Working with the store 115
Adding new elements 116
Looping through the records/models in the store 118
Retrieving the records in the store 119
By index position 119
First and last records 119
By range 119
By ID 120
Removing records 120
Retrieving remote data 121
Ajax proxy 121
Readers 124
The XML reader 125
Sending data 127
Summary 132
Chapter 5: Buttons and Toolbars 133
Event-driven development 133
Creating a simple button 136
Setting icons on buttons 138
Icon alignment on buttons 140
Handling button events 141
Segmented buttons 142
Adding menus 144
Toolbars 148
Toolbar button groups 150
The breadcrumb bar 153
Handling selections in the breadcrumb bar 156
The main menu for our application 158
Summary 163
[ iii ]
Table of Contents
[ iv ]
Table of Contents
[v]
Table of Contents
[ vi ]
Table of Contents
[ vii ]
Preface
Over the past few years, Ext JS has become a popular and powerful JavaScript
framework for desktop application development. For an Ext JS developer, the
learning curve is not very easy/fast and I have seen cases where developers learning
this framework find it to be a slow process. While writing this book I was thinking
about the easiest and most comprehensible points so that you can understand the
basics, just as I would have liked to learn about the framework if I was in your place.
This book is intended for developers who have the desire to learn and begin using
this framework for their applications, and also for developers who have not started
using the current version. It is written as an easy-to-follow guide that will help you
understand the basics and fundamentals of the framework. If you have experience
with previous versions of the framework, this book may clear many of your doubts
about upgrading and how things happen in version 5.x.
This book covers all of the basic information you need to know to start development
with this nice and powerful framework.
Chapter 2, The Core Concepts, is about the framework's class system, and tells you how
to use object-oriented programming with Ext JS. Also, this chapter explains how to
extend classes, how to inherit properties, and the use of the Loader system in order
to define and require dependencies in a dynamic way.
[ ix ]
Preface
Chapter 3, Components and Layouts, explains how components work, how they are
created, their life cycle, and how to take advantage of all this. Here, you also learn
about types of containers and the layout system, which will help you create amazing
UIs with little effort.
Chapter 4, It's All about the Data, explains how the framework handles and
manipulates data to display information using data-aware widgets or components.
Chapter 5, Buttons and Toolbars, shows you how to make use of component events;
listen to events; (mainly) create buttons, toolbars, and menus; and set the most basic
configurations for these components.
Chapter 6, Doing It with Forms, talks about the form component, the available fields
that we can use in our forms, and how to collect and submit data.
Chapter 7, Give Me the Grid, covers the basics of the most popular component, the
Grid panel, in the framework, how to implement it, its column model, and custom
data renderers for displaying data. We also see how to listen to events in the Grid
panel and look at some plugins and features (specific capabilities) that can be
implemented in the grid.
Chapter 8, DataViews and Templates, explains how to make use of DataViews and
templates to create data-aware views, implement a nice organization of our data,
and set styles and custom logic for the representation of data.
Chapter 9, The Tree Panel, covers the use of the tree panel component and its
implementation. It also explains how to create stores and data for this component.
Chapter 10, Architecture, is one of the most important chapters in the book. It shows
how to create an application using the MVC and MVVM patterns. This is done in
order to create applications that can be scalable and easy to maintain. The MVVM
pattern, which is a powerful pattern for reducing code, is introduced in version 5.
Chapter 11, The Look and Feel, demonstrates how to create new themes inside the
framework and applications by giving our applications a new look and some color
changes (themes). Also, you learn how to create specific component-style UIs using
Compass and Sass.
Chapter 12, Responsive Configurations and Tablet Support, explains how we can use
touch screen themes and how to set responsive configurations in components in
order to make those components responsive-aware.
[x]
Preface
Chapter 13, From Drawing to Charting, talks about the basics of drawing and chart
creation. We see how to create charts by the use of the SVG/VML engines. This
chapter also explains how to add the Chart package to applications and the theme
engine introduced in version 5.
Chapter 14, Finishing the Application, covers how to prepare our application for
the production environment and deployment, covering the most essential parts for
final production.
Chapter 15, What's Next?, shows you where to get more feedback and resources such
as forums, other useful resources to get information tutorials from, and so on. This
chapter also gives a sneak peek into some useful plugins (commercial and free).
These browsers come in handy because they come with debugging tools for
easy development.
• Xampp: https://www.apachefriends.org/index.html
[ xi ]
Preface
Conventions
In this book, you will find a number of styles of text that distinguish between
different kinds of information. Here are some examples of these styles, and an
explanation of their meaning.
Code words in text are shown as follows: "Inside the app/view folder, we remove
all existing files (the initial skeleton), and proceed to create the initial view our
application will have."
[ xii ]
Preface
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.define('myApp.store.modulesTreeDs', {
extend: 'Ext.data.TreeStore',
requires: [
'myApp.model.modulesModel',
'Ext.data.proxy.Ajax'
],
constructor: function(cfg) {
var me = this;
cfg = cfg || {};
me.callParent([Ext.apply({
storeId: 'mymodulesTreeDs',
autoLoad: true,
model: 'myApp.model.modulesModel',
proxy: {
type: 'ajax',
url: 'serverside/data/menu_extended.json'
}
}, cfg)]);
}
}); Any command-line input or output is written as follows:
sencha -sdk /path/to/ext generate app myApp /path/to/myApp
[ xiii ]
Preface
New terms and important words are shown in bold. Words that you see on the
screen, in menus or dialog boxes for example, appear in the text like this: "Try to
write something in the Customer ID field and you will see that it is read-only."
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about
this book—what you liked or may have disliked. Reader feedback is important for us
to develop titles that you really get the most out of.
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.
[ xiv ]
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 would 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 on
our website, or added to any list of existing errata, under the Errata section of that
title. Any existing errata can be viewed by selecting your title from http://www.
packtpub.com/support.
Piracy
Piracy of copyright 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
You can contact us at questions@packtpub.com if you are having a problem with
any aspect of the book, and we will do our best to address it.
[ xv ]
An Introduction to Ext JS 5
When learning a new technology such as Ext JS, some developers face a hard time
to begin with, so this book will give you the best possible way to start to understand
this technology more than any other source. We have to go from the library
documentation to blogs and forums looking for answers, trying to figure out how the
library and all the components work together. Even though there are tutorials in the
official learning center, it would be great to have a guide to learn the library from the
basics to a more advanced level; this is the main goal of this book.
Ext JS is a state of the art framework to create Rich Internet Applications (RIAs).
The framework allows us to create cross-browser applications with a powerful set of
components and widgets. The idea behind the framework is to create user-friendly
applications in rapid development cycles, facilitate teamwork (MVC or MVVM), and
also have a long-term maintainability.
Ext JS is not just a library of widgets anymore; the brand new version is a framework
full of new exciting features for us to play with. Some of these features are the new
class system, the loader, the new application package, which defines a standard way
to code our applications, and much more awesome stuff.
The company behind the Ext JS library is Sencha Inc. They work on great products
that are based on web standards. Some of the most famous products that Sencha also
have are Sencha Touch and Sencha Architect.
In this chapter, we will cover the basic concepts of the framework of version 5.
You'll learn how to set up the library or SDK and create our first program, get to
know the available tools to write our code, and take a look at some of the new
features in Ext JS 5.
[1]
An Introduction to Ext JS 5
Ext JS is best suited for enterprise or intranet applications; it's a great tool to develop
an entire CRM or ERP software solution. One of the more appealing examples is the
Desktop sample (http://dev.sencha.com/ext/5.1.0/examples/desktop/index.
html). It really looks and feels like a native application running in the browser. In
some cases, this is an advantage because the users already know how to interact with
the components and we can improve the user experience.
Ext JS 5 came out with a great tool to create themes and templates in a very simple
way. The framework for creating themes is built on top of Compass and Sass, so
we can modify some variables and properties and in a few minutes we can have a
custom template for our Ext JS applications. If we want something more complex
or unique, we can modify the original template to suit our needs. This might be
more time-consuming depending on our experience with Compass and Sass.
Compass and Sass are extensions for CSS. We can use expressions, conditions,
variables, mixins, and many more awesome things to generate well-formatted CSS.
You can learn more about Compass on their website at http://compass-style.org/.
The new class system allows us to define classes incredibly easily. We can develop
our application using the object-oriented programming paradigm and take advantage
of the single and multiple inheritances. This is a great advantage because we can
implement any of the available patterns such as MVC, MVVM, Observable, or any
other. This will allow us to have a good code structure, which leads us to have easy
access for maintenance.
Another thing to keep in mind is the growing community around the library; there
are lots of people around the world that are working with Ext JS right now. You can
even join the meeting groups that have local reunions frequently to share knowledge
and experiences; I recommend you to look for a group in your city or create one.
[2]
Chapter 1
The new loader system is a great way to load our modules or classes on demand.
We can load only the modules and applications that the user needs just in time.
This functionality allows us to bootstrap our application faster by loading only
the minimal code for our application to work.
One more thing to keep in mind is the ability to prepare our code for deployment.
We can compress and obfuscate our code for a production environment using the
Sencha Cmd, a tool that we can run on our terminal to automatically analyze all the
dependencies of our code and create packages.
Documentation is very important and Ext JS has great documentation, which is very
descriptive with a lot of examples, videos, and sample code so that we can see it in
action right on the documentation pages, and we can also read the comments from
the community.
[3]
An Introduction to Ext JS 5
Downloading Ext JS
If you download Ext JS directly from http://www.sencha.com/products/download/,
this will be a 30-day trial version of Ext JS and you will also be required to enter some
personal information in order to get the trial. To obtain the GPL version, you can get
it from http://www.sencha.com/legal/GPL/. We can also use the available Content
Delivery Network (CDN), as shown in the following table, so that we don't need to
store the library on our own computer or server:
Theme Links
Classic • CSS file: http://cdn.sencha.com/ext/trial/5.1.1/
packages/ext-theme-classic/build/resources/ext-
theme-classic-all.css
• JavaScript file: http://cdn.sencha.com/ext/trial/5.1.1/
build/ext-all.js
Neptune • CSS file: http://cdn.sencha.com/ext/trial/5.1.1/
packages/ext-theme-neptune/build/resources/ext-
theme-neptune-all.css
• JavaScript file: http://cdn.sencha.com/ext/trial/5.1.1/
build/ext-all.js
• Theme JS Overrides: http://cdn.sencha.com/ext/
trial/5.1.1/packages/ext-theme-neptune/build/ext-
theme-neptune.js
Crisp • CSS file: http://cdn.sencha.com/ext/trial/5.1.1/
packages/ext-theme-crisp/build/resources/ext-theme-
crisp-all.css
• JavaScript file: http://cdn.sencha.com/ext/trial/5.1.1/
build/ext-all.js
• Theme JS Overrides: http://cdn.sencha.com/ext/
trial/5.1.1/packages/ext-theme-crisp/build/ext-
theme-crisp.js
[4]
Exploring the Variety of Random
Documents with Different Content
parasten opettajaimme ja hurskainten ja ymmärtäväisinten
naistemme kaitsennon alaisiksi.
— Saavatko he naida?
— Entäs yhteiskuntarakennus?
Sit laus, honor Deo patri, laus perennis ejus Nato, iubilus
Spiritui sancto, salus aeterna defunctis; Pax sit regno Suetie.
— Mielelläni.
— Estääpä.
— Minkä?
— Se on salaisuus.
— Mutt'ei tämä.
— Isäni.
— Ja sitten?
— Äitini.
— Ja sitten?
— Gunnar Svantenpoika.
— Svante tohtori.
— Ai! Sitte?
— Fabbe.
— Sitte?
— Sitte?
— Sinä.
*****
MAISTERI LAURI.
122
123
— Perhepuumme.
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
textbookfull.com