Properties Methods Events Config Options Direct Link
Observable
  DataProxy

Class CQ.Ext.data.DataProxy

Package:CQ.Ext.data
Class:DataProxy
Subclasses:DirectProxy, HttpProxy, MemoryProxy, ScriptTagProxy
Extends:CQ.Ext.util.Observable
Clientlib:cq.widgets

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 CQ.Ext.data.DirectProxy, CQ.Ext.data.HttpProxy, CQ.Ext.data.ScriptTagProxy and CQ.Ext.data.MemoryProxy.

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

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

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

Example 1

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

Example 2

proxy : new CQ.Ext.data.HttpProxy({
    method: 'GET',
    prettyUrls: false,
    url: 'local/default.php', // see options parameter for CQ.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.
CQ.Ext.data.DataProxy.on('beforewrite', function(proxy, action) {
    console.log('beforewrite: ', action);
});

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

// Listen to "exception" event fired by all proxies
CQ.Ext.data.DataProxy.on('exception', function(proxy, type, action, exception) {
    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 Options Defined By

Public Properties

Property Defined By
  load : Object
Deprecated.
Deprecated load method using old method signature. See doRequest for preferred method.
DataProxy

Public Methods

Method Defined By

Public Events

Event Defined By