Properties Methods Events Config Options Direct Link

    Observable
      DataProxy
        HttpProxy

# Class Ext.data.HttpProxy

Package: | Ext.data
Defined In: | HttpProxy.js
Class: | HttpProxy
Extends: | DataProxy

An implementation of Ext.data.DataProxy that reads a data object from a Connection object configured to reference a certain URL.

Note that this class cannot be used to retrieve data from a domain other than the domain from which the running page was served.

For cross-domain access to remote data, use a ScriptTagProxy.

Be aware that to enable the browser to parse an XML document, the server must set the Content-Type header in the HTTP response to "text/xml".

## Config Options

Config Options | Defined By
--- | ---
| listeners : Object A config object containing one or more event handlers to be added to this object during initialization. This should b... A config object containing one or more event handlers to be added to this object during initialization. This should be a valid listeners config object as specified in the addListener example for attaching multiple handlers at once. | Observable

## Public Properties

Property | Defined By
--- | ---
| conn : Object The Connection object (Or options parameter to Ext.Ajax.request) which this HttpProxy uses to make requests to the se... The Connection object (Or options parameter to Ext.Ajax.request) which this HttpProxy uses to make requests to the server. Properties of this object may be changed dynamically to change the way data is requested. | HttpProxy

## Public Methods

Method | Defined By
--- | ---
| HttpProxy( `Object conn` ) Parameters: `conn` : Object an Ext.data.Connection object, or options parameter to Ext.Ajax.request. If an options parameter is passed, the singleton Ext.Ajax object will be used to make the request. Returns: `` | HttpProxy
| addEvents( `Object object` ) : void Used to define events on this Observable Used to define events on this Observable Parameters: `object` : Object The object with the events defined Returns: `void` | Observable
- | addListener( `String eventName`, `Function handler`, [`Object scope`], [`Object options`] ) : void Appends an event handler to this component Appends an event handler to this component Parameters: `eventName` : String The type of event to listen for `handler` : Function The method the event invokes `scope` : Object (optional) The scope in which to execute the handler function. The handler function's "this" context. `options` : Object (optional) An object containing handler configuration properties. This may contain any of the following properties: scope : Object The scope in which to execute the handler function. The handler function's "this" context. delay : Number The number of milliseconds to delay the invocation of the handler after the event fires. single : Boolean True to add a handler to handle just the next firing of the event, and then remove itself. buffer : Number Causes the handler to be scheduled to run in an Ext.util.DelayedTask delayed by the specified number of milliseconds. If the event fires again within that time, the original handler is not invoked, but the new handler is scheduled in its place. Combining Options Using the options argument, it is possible to combine different types of listeners: A normalized, delayed, one-time listener that auto stops the event and passes a custom argument (forumId)
      el.on('click', this.onClick, this, {
          single: true,
          delay: 100,
          forumId: 4
      });
  Attaching multiple handlers in 1 call The method also allows for a single argument to be passed which is a config object containing properties which specify multiple handlers.
      foo.on({
          'click' : {
              fn: this.onClick,
              scope: this,
              delay: 100
          },
          'mouseover' : {
              fn: this.onMouseOver,
              scope: this
          },
          'mouseout' : {
              fn: this.onMouseOut,
              scope: this
          }
      });
  Or a shorthand syntax:
      foo.on({
          'click' : this.onClick,
          'mouseover' : this.onMouseOver,
          'mouseout' : this.onMouseOut,
           scope: this
      });
Returns: `void` | Observable
| fireEvent( `String eventName`, `Object... args` ) : Boolean Fires the specified event with the passed parameters (minus the event name). Fires the specified event with the passed parameters (minus the event name). Parameters: `eventName` : String `args` : Object... Variable number of parameters are passed to handlers Returns: `Boolean` returns false if any of the handlers return false otherwise it returns true | Observable
| getConnection() : Connection Return the Ext.data.Connection object being used by this Proxy. Return the Ext.data.Connection object being used by this Proxy. Parameters: None. Returns: `Connection` The Connection object. This object may be used to subscribe to events on a finer-grained basis than the DataProxy events. | HttpProxy
| hasListener( `String eventName` ) : Boolean Checks to see if this object has any listeners for a specified event Checks to see if this object has any listeners for a specified event Parameters: `eventName` : String The name of the event to check for Returns: `Boolean` True if the event is being listened for, else false | Observable
| load( `Object params`, `Ext.data.DataReader reader`, `Function callback`, `Object scope`, `Object arg` ) : void Load data from the configured Ext.data.Connection, read the data object into a block of Ext.data.Records using the pa... Load data from the configured Ext.data.Connection, read the data object into a block of Ext.data.Records using the passed Ext.data.DataReader implementation, and process that block using the passed callback. Parameters: `params` : Object An object containing properties which are to be used as HTTP parameters for the request to the remote server. `reader` : Ext.data.DataReader The Reader object which converts the data object into a block of Ext.data.Records. `callback` : Function The function into which to pass the block of Ext.data.Records. The function must be passed The Record block object The "arg" argument from the load function A boolean success indicator `scope` : Object The scope in which to call the callback `arg` : Object An optional argument which is passed to the callback as its second parameter. Returns: `void` | HttpProxy
| on( `String eventName`, `Function handler`, [`Object scope`], [`Object options`] ) : void Appends an event handler to this element (shorthand for addListener) Appends an event handler to this element (shorthand for addListener) Parameters: `eventName` : String The type of event to listen for `handler` : Function The method the event invokes `scope` : Object (optional) The scope in which to execute the handler function. The handler function's "this" context. `options` : Object (optional) Returns: `void` | Observable
| purgeListeners() : void Removes all listeners for this object Removes all listeners for this object Parameters: None. Returns: `void` | Observable
| relayEvents( `Object o`, `Array events` ) : void Relays selected events from the specified Observable as if the events were fired by `this`. Relays selected events from the specified Observable as if the events were fired by `this`. Parameters: `o` : Object The Observable whose events this object is to relay. `events` : Array Array of event names to relay. Returns: `void` | Observable
| removeListener( `String eventName`, `Function handler`, [`Object scope`] ) : void Removes a listener Removes a listener Parameters: `eventName` : String The type of event to listen for `handler` : Function The handler to remove `scope` : Object (optional) The scope (this object) for the handler Returns: `void` | Observable
| resumeEvents() : void Resume firing events. (see suspendEvents) Resume firing events. (see suspendEvents) Parameters: None. Returns: `void` | Observable
| suspendEvents() : void Suspend the firing of all events. (see resumeEvents) Suspend the firing of all events. (see resumeEvents) Parameters: None. Returns: `void` | Observable
| un( `String eventName`, `Function handler`, [`Object scope`] ) : void Removes a listener (shorthand for removeListener) Removes a listener (shorthand for removeListener) Parameters: `eventName` : String The type of event to listen for `handler` : Function The handler to remove `scope` : Object (optional) The scope (this object) for the handler Returns: `void` | Observable

## Public Events

Event | Defined By
--- | ---
| beforeload : ( `Object this`, `Object params` ) Fires before a network request is made to retrieve a data object. Fires before a network request is made to retrieve a data object. Listeners will be called with the following arguments: `this` : Object `params` : Object The params object passed to the load function | DataProxy
| load : ( `Object this`, `Object o`, `Object arg` ) Fires before the load method's callback is called. Fires before the load method's callback is called. Listeners will be called with the following arguments: `this` : Object `o` : Object The data object `arg` : Object The callback's arg object passed to the load function | DataProxy
| loadexception : ( `Object this`, `Object options`, `Object response`, `Error e` ) Fires if an exception occurs in the Proxy during data loading. This event can be fired for one of two reasons: The l... Fires if an exception occurs in the Proxy during data loading. This event can be fired for one of two reasons: The load call returned success: false. This means the server logic returned a failure status and there is no data to read. In this case, this event will be raised and the fourth parameter (read error) will be null. The load succeeded but the reader could not read the response. This means the server returned data, but the configured Reader threw an error while reading the data. In this case, this event will be raised and the caught error will be passed along as the fourth parameter of this event. Note that this event is also relayed through Ext.data.Store, so you can listen for it directly on any Store instance. Listeners will be called with the following arguments: `this` : Object `options` : Object The loading options that were specified (see load for details) `response` : Object The XMLHttpRequest object containing the response data `e` : Error The JavaScript Error object caught if the configured Reader could not read the data. If the load call returned success: false, this parameter will be null. | HttpProxy