Properties Methods Events Config Options Direct Link
Observable
  DataProxy

Class Ext.data.DataProxy

Package:Ext.data
Defined In:DataProxy.js
Class:DataProxy
Subclasses:DirectProxy, HttpProxy, MemoryProxy, ScriptTagProxy
Extends:Observable

Abstract base class for implementations which provide retrieval of unformatted data objects. This class is intended to be extended and should not be created directly. For existing implementations, see Ext.data.DirectProxy, Ext.data.HttpProxy, Ext.data.ScriptTagProxy and Ext.data.MemoryProxy.

DataProxy implementations are usually used in conjunction with an implementation of Ext.data.DataReader (of the appropriate type which knows how to parse the data object) to provide a block of Ext.data.Records to an Ext.data.Store.

The parameter to a DataProxy constructor may be an Ext.data.Connection or can also be the config object to an Ext.data.Connection.

Custom implementations must implement either the doRequest method (preferred) or the load method (deprecated). See Ext.data.HttpProxy.doRequest or Ext.data.HttpProxy.load for additional details.

Example 1

proxy: new Ext.data.ScriptTagProxy({
    url: 'http://extjs.com/forum/topics-remote.php'
}),

Example 2

proxy : new Ext.data.HttpProxy({
    method: 'GET',
    prettyUrls: false,
    url: 'local/default.php', // see options parameter for Ext.Ajax.request
    api: {
        // all actions except the following will use above url
        create  : 'local/new.php',
        update  : 'local/update.php'
    }
}),

And new in Ext version 3, attach centralized event-listeners upon the DataProxy class itself! This is a great place to implement a messaging system to centralize your application's user-feedback and error-handling.

// Listen to all "beforewrite" event fired by all proxies.
Ext.data.DataProxy.on('beforewrite', function(proxy, action) {
    console.log('beforewrite: ', action);
});

// Listen to "write" event fired by all proxies
Ext.data.DataProxy.on('write', function(proxy, action, data, res, rs) {
    console.info('write: ', action);
});

// Listen to "exception" event fired by all proxies
Ext.data.DataProxy.on('exception', function(proxy, type, action) {
    console.error(type + action + ' exception);
});
Note: These three events are all fired with the signature of the corresponding DataProxy instance event beforewrite, write and exception.

Config Options

Config OptionsDefined By

Public Properties

This class has no public properties.

Public Methods

MethodDefined By

Public Events

EventDefined By