Observable DataProxy HttpProxy
Package: | Ext.data |
Defined In: | HttpProxy.js |
Class: | HttpProxy |
Extends: | DataProxy |
An implementation of Ext.data.DataProxy that processes data requests within the same domain of the originating page.
Note: 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 requests, 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 | Defined By | |
---|---|---|
api : Object Specific urls to call on CRUD action methods "read", "create", "update" and "destroy".
Defaults to:api: {
read ... Specific urls to call on CRUD action methods "read", "create", "update" and "destroy".
Defaults to:
If the specific URL for a given CRUD action is undefined, the CRUD action request will be directed to the configured url. Note: To modify the URL for an action dynamically the appropriate API property should be modified before the action is requested using the corresponding before action event. For example to modify the URL associated with the load action:
| DataProxy | |
doRequest : Function Abstract method that should be implemented in all subclasses
(e.g.: HttpProxy.doRequest,
DirectProxy.doRequest). | DataProxy | |
listeners : Object A config object containing one or more event handlers to be added to this
object during initialization. This should ... 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. DOM events from ExtJs Components While some ExtJs Component classes export selected DOM events (e.g. "click", "mouseover" etc), this
is usually only done when extra value can be added. For example the DataView's
| Observable | |
restful : Boolean If set to true, a non-phantom record's
id will be appended to the url (defaults to false).
The url is built based u... If set to true, a non-phantom record's id will be appended to the url (defaults to false). The url is built based upon the action being executed [load|create|save|destroy] using the commensurate api property, or if undefined default to the configured Ext.data.Store.url. Some MVC (e.g., Ruby on Rails, Merb and Django) support this style of segment based urls where the segments in the URL follow the Model-View-Controller approach.
Where the segments in the url are typically:
For example:
| HttpProxy |
Property | Defined By | |
---|---|---|
conn : Object The Connection object (Or options parameter to Ext.Ajax.request) which this HttpProxy
uses to make requests to the s... 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 |
Method | Defined By | |
---|---|---|
HttpProxy( Object conn )
Parameters:
| HttpProxy | |
addEvents( Object object )
:
voidUsed to define events on this Observable Used to define events on this Observable Parameters:
| Observable | |
addListener( String eventName , Function handler , [Object scope ], [Object options ] )
:
voidAppends an event handler to this object. Appends an event handler to this object. Parameters:
| Observable | |
destroy()
:
void Destroys the proxy by purging any event listeners and cancelling any active requests. Destroys the proxy by purging any event listeners and cancelling any active requests. Parameters:
| DataProxy | |
doRequest( String action , Ext.data.Record/Ext.data.Record[] rs , Object params , Ext.data.DataReader reader , Function callback , Object scope , Object arg )
:
voidHttpProxy implementation of DataProxy#doRequest HttpProxy implementation of DataProxy#doRequest Parameters:
| HttpProxy | |
enableBubble( Object events )
:
voidUsed to enable bubbling of events Used to enable bubbling of events Parameters:
| Observable | |
fireEvent( String eventName , Object... args )
:
BooleanFires the specified event with the passed parameters (minus the event name).
An event may be set to bubble up an Obse... Fires the specified event with the passed parameters (minus the event name). An event may be set to bubble up an Observable parent hierarchy (See Ext.Component.getBubbleTarget) by calling enableBubble. Parameters:
| 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:
| HttpProxy | |
hasListener( String eventName )
:
BooleanChecks 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:
| Observable | |
isApiAction( String [Ext.data.Api.CREATE|READ|UPDATE|DESTROY]} )
:
BooleanReturns true if the specified action is defined as a unique action in the api-config.
request. If all API-actions a... Returns true if the specified action is defined as a unique action in the api-config.
request. If all API-actions are routed to unique urls, the xaction parameter is unecessary. However, if no api is defined
and all Proxy actions are routed to DataProxy#url, the server-side will require the xaction parameter to perform a switch to
the corresponding code for CRUD action. Parameters:
| DataProxy | |
load( Object params , Object reader , Object callback , Object scope , Object arg )
:
voidDeprecated load method using old method signature. See {@doRequest} for preferred method. Deprecated load method using old method signature. See {@doRequest} for preferred method. Parameters:
| DataProxy | |
on( String eventName , Function handler , [Object scope ], [Object options ] )
:
voidAppends an event handler to this object (shorthand for addListener.) Appends an event handler to this object (shorthand for addListener.) Parameters:
| Observable | |
purgeListeners()
:
void Removes all listeners for this object Removes all listeners for this object Parameters:
| Observable | |
relayEvents( Object o , Array events )
:
voidRelays 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:
| Observable | |
removeListener( String eventName , Function handler , [Object scope ] )
:
voidRemoves an event handler. Removes an event handler. Parameters:
| Observable | |
request( String action , Ext.data.Record/Ext.data.Record[]/null rs , Object params , Ext.data.DataReader reader , Function callback , Object scope , Object options )
:
voidAll proxy actions are executed through this method. Automatically fires the "before" + action event All proxy actions are executed through this method. Automatically fires the "before" + action event Parameters:
| DataProxy | |
resumeEvents()
:
void Resume firing events. (see suspendEvents)
If events were suspended using the queueSuspended parameter, then all
event... Resume firing events. (see suspendEvents)
If events were suspended using the queueSuspended parameter, then all
events fired during event suspension will be sent to any listeners now. Parameters:
| Observable | |
setApi( String/Object api , String/Function url )
:
voidRedefines the Proxy's API or a single action of an API. Can be called with two method signatures.
If called with an ... Redefines the Proxy's API or a single action of an API. Can be called with two method signatures. If called with an object as the only parameter, the object should redefine the entire API, e.g.:
If called with two parameters, the first parameter should be a string specifying the API action to redefine and the second parameter should be the URL (or function if using DirectProxy) to call for that action, e.g.:
Parameters:
| DataProxy | |
setUrl( String url , [Boolean makePermanent ] )
:
voidUsed for overriding the url used for a single request. Designed to be called during a beforeaction event. Calling s... Used for overriding the url used for a single request. Designed to be called during a beforeaction event. Calling setUrl
will override any urls set via the api configuration parameter. Set the optional parameter makePermanent to set the url for
all subsequent requests. If not set to makePermanent, the next request will use the same url or api configuration defined
in the initial proxy configuration. Parameters:
| HttpProxy | |
suspendEvents( Boolean queueSuspended )
:
voidSuspend the firing of all events. (see resumeEvents) Suspend the firing of all events. (see resumeEvents) Parameters:
| Observable | |
un( String eventName , Function handler , [Object scope ] )
:
voidRemoves an event handler (shorthand for removeListener.) Removes an event handler (shorthand for removeListener.) Parameters:
| Observable |
Event | Defined By | |
---|---|---|
beforeload :
( DataProxy this , Object params )
Fires before a request to retrieve a data object. Fires before a request to retrieve a data object. Listeners will be called with the following arguments:
| DataProxy | |
beforewrite :
( DataProxy this , String action , Record/Array[Record] rs , Object params )
Fires before a request is generated for one of the actions Ext.data.Api.actions.create|update|destroy Fires before a request is generated for one of the actions Ext.data.Api.actions.create|update|destroy Listeners will be called with the following arguments:
| DataProxy | |
exception :
( DataProxy this , String type , String action , Object options , Object response , Mixed arg )
Fires if an exception occurs in the Proxy during a remote request.
This event is relayed through a corresponding
Ex... Fires if an exception occurs in the Proxy during a remote request. This event is relayed through a corresponding Ext.data.Store.exception, so any Store instance may observe this event. This event can be fired for one of two reasons:
This event fires with two different contexts based upon the 2nd parameter type [remote|response]. The first four parameters are identical between the two contexts -- only the final two parameters differ. Listeners will be called with the following arguments:
| DataProxy | |
load :
( DataProxy this , Object o , Object options )
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:
| DataProxy | |
loadexception :
( misc misc )
This event is deprecated. The signature of the loadexception event
varies depending on the proxy, use the catch-all... | DataProxy | |
write :
( DataProxy this , String action , Object data , Object response , Record/Record{} rs , Object options )
Fires before the request-callback is called Fires before the request-callback is called Listeners will be called with the following arguments:
| DataProxy |