Chapter 7. The data store

 

This chapter covers

  • Using the data store
  • Understanding data proxies
  • Exploring writers and validations

To create a real-world application, you need a way to persist data. Data persistence allows users of your application to access data between sessions, so the data should be stored on a medium that enables it to be accessed after your application has been stopped and started again.

Data persistence can happen by updating or retrieving the data from the components on screen using Ajax techniques if you’re implementing simple applications. But if you’re creating an Ext JS application that involves advanced interaction logic on the client side, you can use the functionality available in the Ext JS data store.

This chapter begins by taking a bird’s-eye view of the data package. We’ll introduce Ext.data.Store and its supporting classes, including Ext.data.Model. You’ll learn how data flows and how it’s consumed by the data store. We’ll discuss the various data readers and explore data consumption with array, JSON, and XML data.

You’ll become familiar with each of the data proxies and see how to load data from resident memory, Ajax, JSONP, and LocalStorage. At this end of the chapter we’ll introduce advanced features of the data package in Ext JS 4 by demonstrating how to handle data validation and associations.

7.1. Introducing the data store

7.2. Loading and saving data

7.3. A store with Writer

7.4. Associating data

7.5. Summary