Data Loading

Ext GWT includes a very powerful and configurable API for data loading. The API includes a large list of classes and interfaces which can cause confusion when first working with the library. The tutorial will cover the high level concepts and design of this framework.

Loaders

Loaders are objects that are used to retrieve different types of remote data. Data loading begins with the Loader interface. This is the base interface for all loaders.

LoadConfig

LoadConfig is an object that is passed to the server which contains the information needed to complete the load request. LoadConfig objects can be of any type. Many data loaders define a required load config type. For example, when using a paging table, the load config must be a PagingLoadConfig, which will contain the current offset and page size which be used when by the server side code when retrieving the requested data.

LoadResult

LoadResult defines the object that is returned by the server in a data load operation. LoadResult objects can be of any type but many data loaders define a required type.

Sequence

  1. The load() method is called on the loader instance.
  2. The loader makes a data load request using LoadConfig instance for the input.
  3. The server returns the data via a LoadResult as the output.

DataProxy and DataReader

The loader uses a DataProxy to communicate with the server and retrieve the returned data, while the DataReader is used to process the raw data returned by the server.

There are several data proxy and data reader subclasses to handle the various ways of server communication and handle different types of raw data.

The basic sequence of a data load operation using a DataProxy and DataReader is:

  1. The load() method is called on the loader instance.
  2. The loader makes a data load request by forwarding the request to the DataProxy.
  3. The DataProxy makes the server call and accepts the returned data.
  4. The raw data is passed to the DataReader and it is converted into the required data type.

Stores

Store is a specialized cache of model instances. Store adds support for both editing, sorting and filtering.

Stores can be bound to some Ext GWT data components. This list currently includes:

When bound, the components listen for the stores events and automatically update the UI to reflect changes to the store. For examples, if a child is added to a store, any bound tables will add the new record to the table. This works the same with sorting and filtering.

A Loader can be bound to a store. When the store has a loader, it will use it for its data requests.

Binders

Binders are used to "connect" a data component to a Store. When connected, the binder listens and handles all the Store events. Binders also provide a mechanism for specifying a model's text value and icon style.