X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..92c2b89db26be16707f4a805d3303ab2531006e1:/docs/output/Ext.data.HttpProxy.html?ds=sidebyside diff --git a/docs/output/Ext.data.HttpProxy.html b/docs/output/Ext.data.HttpProxy.html index bf3a049a..fd413da9 100644 --- a/docs/output/Ext.data.HttpProxy.html +++ b/docs/output/Ext.data.HttpProxy.html @@ -1,4 +1,4 @@ -
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 +
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 @@ -13,6 +13,24 @@ Defaults to:
api: {
update : undefined,
destroy : undefined
}
+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.
For example:
+api: {
+ load : '/controller/load',
+ create : '/controller/new', // Server MUST return idProperty of new record
+ save : '/controller/update',
+ destroy : '/controller/destroy_action'
+}
+
+// Alternatively, one can use the object-form to specify each API-action
+api: {
+ load: {url: 'read.php', method: 'GET'},
+ create: 'create.php',
+ destroy: 'destroy.php',
+ save: 'update.php'
+}
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 @@ -29,22 +47,9 @@ myStore.on({ // permanent, applying this URL for all subsequent requests. store.proxy.setUrl('changed1.php', true); - // manually set the private connection URL. - // Warning: Accessing the private URL property should be avoided. - // Use the public method setUrl instead, shown above. - // It should be noted that changing the URL like this will affect - // the URL for just this request. Subsequent requests will use the - // API or URL defined in your initial proxy configuration. - store.proxy.conn.url = 'changed1.php'; - - // proxy URL will be superseded by API (only if proxy created to use ajax): - // It should be noted that proxy API changes are permanent and will - // be used for all subsequent requests. - store.proxy.api.load = 'changed2.php'; - - // However, altering the proxy API should be done using the public - // method setApi instead. - store.proxy.setApi('load', 'changed2.php'); + // Altering the proxy API should be done using the public + // method setApi. + store.proxy.setApi('read', 'changed2.php'); // Or set the entire API with a config-object. // When using the config-object option, you must redefine the entire @@ -58,9 +63,9 @@ myStore.on({ } } }); -
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.
@@ -115,48 +120,53 @@ Ext.DomObserver = Ext.extend(Object, { typeAhead: true, mode: 'local', triggerAction: 'all' -});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.
someSite.com/controller/action/id
+});Defaults to false. Set to true to operate in a RESTful manner.
+ Note: this parameter will automatically be set to true if the
+Ext.data.Store it is plugged into is set to restful: true
. If the
+Store is RESTful, there is no need to set this option on the proxy.
RESTful implementations enable the serverside framework to automatically route +actions sent to one url based upon the HTTP method, for example: +
store: new Ext.data.Store({
+ restful: true,
+ proxy: new Ext.data.HttpProxy({url:'/users'}); // all requests sent to /users
+ ...
+)}
+If there is no api
specified in the configuration of the proxy,
+all requests will be marshalled to a single RESTful url (/users) so the serverside
+framework can inspect the HTTP Method and act accordingly:
++Method url action +POST /users create +GET /users read +PUT /users/23 update +DESTROY /users/23 delete ++
If set to true, a non-phantom record's +id will be appended to the url. Some MVC (e.g., Ruby on Rails, +Merb and Django) support segment based urls where the segments in the URL follow the +Model-View-Controller approach:
someSite.com/controller/action/id
Where the segments in the url are typically:For example:
-api: {
- load : '/controller/load',
- create : '/controller/new', // Server MUST return idProperty of new record
- save : '/controller/update',
- destroy : '/controller/destroy_action'
-}
-
-// Alternatively, one can use the object-form to specify each API-action
-api: {
- load: {url: 'read.php', method: 'GET'},
- create: 'create.php',
- destroy: 'destroy.php',
- save: 'update.php'
-}
Property | Defined By | |
---|---|---|
conn : Object The Connection object (Or options parameter to Ext.Ajax.request) which this HttpProxy
+ Refer to | DataProxy |
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 )
+the request.Returns:
| HttpProxy | |
addEvents( Object|String o , string Optional. )
:
- 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 ] )
+ voidAdds the specified events to the list of events which this Observable may fire. Adds the specified events to the list of events which this Observable may fire. 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 )
@@ -217,9 +227,41 @@ object into a block of Ext.data.Records.callback : F
The callback is passed the following arguments:
scope : ObjectThe scope in which to call the callback arg : ObjectAn optional argument which is passed to the callback as its second parameter.
| HttpProxy | |
enableBubble( Object events )
+scope : ObjectThe scope ( this reference) in which the callback function is executed. Defaults to the browser window.arg : ObjectAn optional argument which is passed to the callback as its second parameter.
| HttpProxy | |
enableBubble( String/Array events )
:
- voidUsed to enable bubbling of events Used to enable bubbling of events Parameters:
| Observable | |
fireEvent( String eventName , Object... args )
+ voidEnables events fired by this Observable to bubble up an owner hierarchy by calling
+this.getBubbleTarget() if present... Enables events fired by this Observable to bubble up an owner hierarchy by calling
+ This is commonly used by Ext.Components to bubble events to owner Containers. See Ext.Component.getBubbleTarget. The default +implementation in Ext.Component returns the Component's immediate owner. But if a known target is required, this can be overridden to +access the required target more quickly. +Example:
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). @@ -240,7 +282,11 @@ the corresponding code for CRUD action.Param
void Deprecated 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()
+If omitted, defaults to the object which fired the event.options : Object(optional) An object containing handler configuration.
| Observable | |
onRead( String action , Object o , Object res )
+ :
+ voidCallback for read action Callback for read action Parameters:
| HttpProxy | |
onWrite( String action , Object trans , Object res )
+ :
+ voidCallback for write actions Callback for write actions Parameters:
| HttpProxy | |
purgeListeners()
:
void Removes all listeners for this object Removes all listeners for this object Parameters:
| Observable | |
relayEvents( Object o , Array events )
:
@@ -248,7 +294,7 @@ the corresponding code for CRUD action.Param
:
void Removes 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 All 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
@@ -280,15 +326,20 @@ after the 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 :
+ Fires before a request is generated for one of the actions Ext.data.Api.actions.create|update|destroy
+In addition to... Fires before a request is generated for one of the actions Ext.data.Api.actions.create|update|destroy +In addition to being fired through the DataProxy instance that raised the event, this event is also fired +through the Ext.data.DataProxy class to allow for centralized processing of beforewrite events from all +DataProxies by attaching a listener to the Ext.data.Proxy class itself. 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: +Fires if an exception occurs in the Proxy during a remote request. This event is relayed
+through a corresponding Ext... 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. +In addition to being fired through the DataProxy instance that raised the event, this event is also fired +through the Ext.data.DataProxy class to allow for centralized processing of exception events from all +DataProxies by attaching a listener to the Ext.data.Proxy class itself. +This event can be fired for one of two reasons:
| 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 |
Fires before the request-callback is called
+In addition to being fired through the DataProxy instance that raised the event, this event is also fired +through the Ext.data.DataProxy class to allow for centralized processing of write events from all +DataProxies by attaching a listener to the Ext.data.Proxy class itself.
this
: DataProxyaction
: Stringdata
: Objectresponse
: Objectrs
: Record/Record{}options
: Object