Book Image

Ext JS Essentials

By : Stuart Ashworth , Andrew Duncan
Book Image

Ext JS Essentials

By: Stuart Ashworth , Andrew Duncan

Overview of this book

<p>Ext JS 5 is a heavyweight JavaScript framework used by millions to build rich and interactive web applications. Its numerous widgets and advanced data package make it especially well-suited for enterprise class software. The framework encourages the creation of good architectures and is extremely customizable.</p> <p>Ext JS Essentials is aimed at giving you a fast-track understanding of Ext JS. This book covers the most important aspects of the framework in a concise but comprehensive way, ensuring your success using its many features.</p> <p>Written around an example application, the book is packed with practical insights into how the framework works, architecting your applications, working with data, and the many widgets on offer.</p>
Table of Contents (17 chapters)
Ext JS Essentials
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Working with stores


Stores are a collection of model instances that allow these models to be manipulated (for example, sorted, filtered, searched, and so on). They also provide a platform for backend interaction. Many of Ext JS' components can be bound to data stores and take care of a lot of the plumbing required to react to changes in the data held within it.

In this section, we will discuss how to construct a simple store and how to perform simple manipulation of the data within it; how to create different views of a dataset using Chained stores; and finally, how hierarchical data can be stored using TreeStores.

Simple stores

To define a store, you must extend the Ext.data.Store class and configure it with a model class that it will hold a collection of. The following store definition shows a store containing a collection of user records:

Ext.define('BizDash.store.Users', {
  extend: 'Ext.data.Store',
  model: 'BizDash.model.User'
});

We can now add our store to the stores config option in...